如何使用UIAppearance外观当包含在: [英] how to use UIAppearance appearanceWhenContainedIn:

查看:121
本文介绍了如何使用UIAppearance外观当包含在:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在iOS5中我们可以通过 UIAppearance 自定义UIKit控件,然后我开始使用它。

I notice that in iOS5 we can custom UIKit control by UIAppearance and I start to use it.

我想使用 appearanceWhenContainedIn:来自定义 UINavigationBar tintColor 在不同的类中,例如:

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]];

然而,它完全不起作用。我尝试在类A / B中添加属性,如:

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;

它似乎也没用。

任何提示?
谢谢。

Any tips? Thanks.

推荐答案

我参加了ios5演讲并提出了这个问题。
就像 yakovlev 所提到的那样,将 UINavigationController

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

这篇关于如何使用UIAppearance外观当包含在:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆