更改 UIImagePickerController 导航条文字的颜色

2017 年 2 月 21 日 0 条评论 3.18k 次阅读 1 人点赞

UIImagePickerController 继承自 UINavigationController, 需求要设置统一的字体颜色.

百度之后, 试了多种颜色也没有解决.后来想到有一个方法可以设置系统统一的样式: UIAppearance这个协议.

凡是遵守这个协议的都可以在AppDelegate中统一设置整个系统的颜色. 但是不要和UIAppearanceContainer搞混了, UIAppearanceContainer协议下没有声明任何方法.

设置UIBarButtonItem和UINavigationBar的默认文字颜色

[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];

 

NSMutableDictionary *attrs = [NSMutableDictionary dictionary];

attrs[NSForegroundColorAttributeName] = [UIColor whiteColor];

[[UINavigationBar appearance] setTitleTextAttributes:attrs];

 

这样就可以随意设置 UIImagePickerController 导航条的样式了

雷雷

这个人太懒什么东西都没留下

文章评论(0)

(Spamcheck Enabled)