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)