how to use UIAppearance appearanceWhenContainedIn:

此生再无相见时 提交于 2019-12-07 13:35:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!