我有一个IBAction
响应我想用来更改图标显示颜色的选择器。我在Interface Builder中设置了darkGrayColor
作为色调,但是当通过代码更改tintColor
时,色调总是变为默认颜色,使图标变为白色。
UIColor *dayColor = [UIColor darkGrayColor];
UIColor *nightColor = [UIColor lightGrayColor];
dayMode = !dayModeSwitch.on;
if (dayMode) {
[tocButton setTintColor:dayColor];
[actionButton setTintColor:dayColor];
[searchButton setTintColor:dayColor];
} else {
[tocButton setTintColor:nightColor];
[actionButton setTintColor:nightColor];
[searchButton setTintColor:nightColor];
}