在iOS 5中具有更多外观控制,我们如何更改UITabBarItem文本颜色?从默认白色到其他颜色?
编辑:工作解决方案
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor blackColor], UITextAttributeTextColor,
[UIColor whiteColor], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, 1)], UITextAttributeTextShadowOffset,
[UIFont fontWithName:@"Rok" size:0.0], UITextAttributeFont,
nil]
forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud) 我正在为我的iPhone应用程序的UI使用字体很棒的资源: FontAwesome
我在我的应用程序屏幕中使用它,如下所示:
Phone.font = [UIFont fontWithName:kFontAwesomeFamilyName size:40];
Phone.text = [NSString fontAwesomeIconStringForIconIdentifier:@"fa-phone"];
Run Code Online (Sandbox Code Playgroud)
但现在我想在我的标签栏控制器的标签栏项目中使用它,即我想将标签栏的图标设置为字体真棒元素.如何才能做到这一点?
我想将tabBar标题字体设置为ubuntu,但我无法设置.
我在下面写下代码:
self.tabBarController.navigationController.navigationBar.titleTextAttributes =
@{NSForegroundColorAttributeName: [UIColor whiteColor],
NSFontAttributeName:[UIFont fontWithName:@"Ubuntu" size:9.0f]};
Run Code Online (Sandbox Code Playgroud)