2

I have an IBAction responding to a selector that I want to use to change the displayed color of the icons. I set in Interface Builder a darkGrayColor for tint, but when changing the tintColor through code, the tint always goes to default color, making the icon white.

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];
}
4

0 回答 0