关闭

不要用Appearance proxy设置UIView的tintColor

标签: ios7uiuiviewtintcolor
788人阅读 评论(0) 收藏 举报
分类:

在iOS7以后就不要用Appearance proxy来设置UIView的tintColor,否则会影响其它的tintColor.

最开始我不知道,就用这方法来设置了UITextView的tintColor

[[UITextView appearance] setTintColor:[UIColor blueColor]];

结果在设置UIBarButtonItem的tintColor的时候就没有效果

UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
backItem.tintColor = [UIColor redColor];
self.navigationItem.leftBarButtonItem = backItem;

原因在UIAppearance.h中

Note for iOS7: On iOS7 the tintColor property has moved to UIView, and now has special inherited behavior described in UIView.h.
This inherited behavior can conflict with the appearance proxy, and therefore tintColor is now disallowed with the appearance proxy.

所有不要用Appearance proxy来设置UIView的tintColor。

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1528093次
    • 积分:19601
    • 等级:
    • 排名:第424名
    • 原创:384篇
    • 转载:45篇
    • 译文:10篇
    • 评论:437条
    博客专栏
    友情链接
    Java
    Java相关