Ios5 包含以下内容时如何使用UIAppearance:
我注意到在iOS5中,我们可以通过Ios5 包含以下内容时如何使用UIAppearance:,ios5,custom-controls,Ios5,Custom Controls,我注意到在iOS5中,我们可以通过UIAppearance定制UIKit控件,我开始使用它 我想使用appearancewhen contained in:在不同的类中自定义UINavigationBar的tintColor,例如: [[UINavigationBar appearanceWhenContainedIn:[A class], nil] setTintColor:[UIColor greenColor]]; [[UINavigationBar appearanceWhenCont
UIAppearance
定制UIKit控件,我开始使用它
我想使用appearancewhen contained in:
在不同的类中自定义UINavigationBar
的tintColor
,例如:
[[UINavigationBar appearanceWhenContainedIn:[A class], nil] setTintColor:[UIColor greenColor]];
[[UINavigationBar appearanceWhenContainedIn:[B class], nil] setTintColor:[UIColor redColor]];
然而,它完全不起作用。我尝试在类A/B中添加属性,如:
@property (strong, nonatomic) UIColor *tintColor UI_APPEARANCE_SELECTOR;
它似乎也没有工作
有什么建议吗?
谢谢。我参加了ios5的讲座并提出了这个问题。
就像引用一样,为其他UIKit控件(如UIButton)的
UINavigationController
子类化是一个好主意,它可以工作。但UINavigationBar不起作用。可能与包含有关。您的示例对我来说效果很好(A和B是两个不同的UINavigationController子类)。我对UINavigationController进行了子类化,但[[UINavigationBar AppearanceWhen contained in:[A class],nil]setTintColor:[UIColor greenColor]];尚未工作,是否需要执行任何其他配置?