Har*_*hit 5 fonts objective-c set tabbar ios
我想将tabBar标题字体设置为ubuntu,但我无法设置.
我在下面写下代码:
self.tabBarController.navigationController.navigationBar.titleTextAttributes =
@{NSForegroundColorAttributeName: [UIColor whiteColor],
NSFontAttributeName:[UIFont fontWithName:@"Ubuntu" size:9.0f]};
Run Code Online (Sandbox Code Playgroud)
小智 1
Objective C 代码-
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont fontWithName:@"your_font_name" size:20.0f], NSFontAttributeName, nil] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
SWIFT代码-
UITabBarItem.appearance().setTitleTextAttributes(
[NSFontAttributeName: UIFont(name:"your_font_name", size:11)!,
NSForegroundColorAttributeName: UIColor(rgb: 0x929292)],
forState: .Normal)
Run Code Online (Sandbox Code Playgroud)
更多参考 - iOS5 TabBar 字体和颜色