我注意到在 iOS5 中我们可以通过 UIAppearance
自定义 UIKit 控件,我开始使用它。
我想使用appearanceWhenContainedIn:
在不同的类中自定义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 讲座并问了这个问题。
就像yakovlev引用,将 UINavigationController
子类化是个好主意。
关于ios5 - 如何使用 UIAppearance appearanceWhenContainedIn :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8290981/