问题
I notice that in iOS5 we can custom UIKit control by UIAppearance
and I start to use it.
I'd like to use appearanceWhenContainedIn:
to custom the UINavigationBar
's tintColor
in different class, for example:
[[UINavigationBar appearanceWhenContainedIn:[A class], nil] setTintColor:[UIColor greenColor]];
[[UINavigationBar appearanceWhenContainedIn:[B class], nil] setTintColor:[UIColor redColor]];
However, it totally doesn't work. And I tried to add property in Class A/B like:
@property (strong, nonatomic) UIColor *tintColor UI_APPEARANCE_SELECTOR;
It seems workless too.
Any tips? Thanks.
回答1:
I attended the ios5 talk and asked this question.
Just like yakovlev refers, it's a good idea to subclass the UINavigationController
.
来源:https://stackoverflow.com/questions/8290981/how-to-use-uiappearance-appearancewhencontainedin