我無法使用接受的答案更改字體。這是我在
didFinishLaunchingWithOptions
方法的AppDelegate以後使用:
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
[tabBarItem1 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17 weight:UIFontWeightBold], NSFontAttributeName, nil] forState:UIControlStateSelected];
[tabBarItem2 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17 weight:UIFontWeightBold], NSFontAttributeName, nil] forState:UIControlStateSelected];
[tabBarItem1 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17 weight:UIFontWeightBold], NSFontAttributeName, nil] forState:UIControlStateNormal];
[tabBarItem2 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17 weight:UIFontWeightBold], NSFontAttributeName, nil] forState:UIControlStateNormal];
點擊此處瞭解詳情:http://www.appcoda.com/ios-programming-how-to-customize-tab-bar-background-appearance/
是這樣解決了嗎? – headkit