scorpiozj
scorpiozj

Reputation: 2687

how to use UIAppearance appearanceWhenContainedIn:

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.

Upvotes: 3

Views: 4331

Answers (1)

scorpiozj
scorpiozj

Reputation: 2687

I attended the ios5 talk and asked this question. Just like yakovlev refers, it's a good idea to subclass the UINavigationController.

Upvotes: 4

Related Questions