iOS - 使用外观全局更改导航栏标题颜色? [英] iOS - Globally change navigation bar title color using appearance?
本文介绍了iOS - 使用外观全局更改导航栏标题颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这会导致应用崩溃:
[[UINavigationBar appearance] setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
有没有办法使用外观来做到这一点?
Is there a way to do this using appearance?
推荐答案
这有效:
NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], UITextAttributeTextColor, [UIColor whiteColor], UITextAttributeTextShadowColor, nil];
[[UINavigationBar appearance] setTitleTextAttributes:textTitleOptions];
这篇关于iOS - 使用外观全局更改导航栏标题颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文