draveness / DKNightVersion

Manage Colors, Integrate Night/Multiple Themes. (Unmaintained)
MIT License
3.55k stars 516 forks source link

按钮根据不同状态设置颜色有问题 #13

Closed mahong125 closed 9 years ago

mahong125 commented 9 years ago

您好,引入夜间模式以后,根据不同的状态设置按钮文字颜色出现问题,按钮文字的颜色总是以最后一次设置的为准,代码如下: UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = self.view.bounds; [btn setTitle:@"hh" forState:UIControlStateNormal]; [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btn setTitle:@"ss" forState:UIControlStateSelected]; [btn setTitleColor:[UIColor orangeColor] forState:UIControlStateSelected]; [btn addTarget:self action:@selector(btnaction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn];

btn 的 titleColor 默认为 [UIColor orangeColor]; 如果这样写的话 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = self.view.bounds; [btn setTitle:@"hh" forState:UIControlStateNormal]; [btn setTitle:@"ss" forState:UIControlStateSelected]; [btn setTitleColor:[UIColor orangeColor] forState:UIControlStateSelected]; [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(btnaction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btn];

btn的titleColor为 [UIColor whiteColor]

即引入夜间模式后,根据不同状态设置按钮titleColor失效,希望您能给我看下,谢谢。

draveness commented 9 years ago

Please use markdown instead. DKNightVersion do not support button with different state.