我正在使用下面的一小段代码来改变我的导航栏标题应用程序的文本属性,它的效果很好。UIBarButtonItem外观iOS5字体?
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor grayColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Cochin-BoldItalic" size:0.0], UITextAttributeFont,
nil]];
但我希望能够很容易地做到这一点的UIBarButtonItem为文本以及,但我不能算出它,因为它没有分享它出现相同或类似的方法。任何帮助表示感谢,谢谢。
编辑:尝试这个代码,而不是做对文本进行修改:
[[UIBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor grayColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Cochin-BoldItalic" size:12.0], UITextAttributeFont,
nil]
forState:UIControlStateNormal];
嗯,没想到这一点。试了一下,它编译和运行,这是进步,但它并没有改变我的酒吧按钮文本的任何属性!我已经在我的OP中添加了使用的代码。 – 2012-07-19 21:21:31
@JoshKahane尝试我刚刚发布的内容 – Nosrettap 2012-07-19 21:38:46