设置UIBarButtonItem色调始终显示默认颜色

时间:2013-03-13 11:17:38

标签: ios objective-c uibarbuttonitem uiappearance

我有一个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];
}

0 个答案:

没有答案