【发布时间】:2015-03-24 02:30:35
【问题描述】:
我有一个 UIBarButtonItem 实例。
我想将 UIBarButtonItem 的 tintColor 更改为 orangeColor。
并且我还在 Appdelegate 中将 UITextField 的外观更改为 orangeColor。
// some view controller
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:nil action:nil];
[barButtonItem setTintColor:[KLStyle colorTitleOrangle]];
// Appdelegate.h
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[UITextField appearance] setTintColor:[UIColor orangeColor]];
}
如果我不评论 [[UITextField appearance] setTintColor:[UIColor orangeColor]]; 会有问题,UIBarButtonItem 的 tintColor 会出错。它仍然是默认的 tintColor blue。
如果我评论它,UIBarButtonItem 的 tintColor 将是正确的。
有人知道为什么会发生这种情况吗?
感谢您的帮助!
【问题讨论】:
-
奇怪的是,我也遇到了同样的问题。我认为这是一个错误,并将向 Apple 提交报告,我建议您也这样做。
-
感谢您的报告!
-
伙计...刚遇到这个问题。把我该死的头撞在墙上!直到我已经弄清楚了,我才看到这个答案...... :(
-
我也有同样的问题
-
UIBarButtonItem的tintColor会出错以及设置UIImage的tintColor外观
标签: ios uitextfield uibarbuttonitem uiappearance