Changing font size of tabbaritem Changing font size of tabbaritem ios ios

Changing font size of tabbaritem


I recommend a better way:

[yourTabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:    [UIColor whiteColor], UITextAttributeTextColor,     [NSValue valueWithUIOffset:UIOffsetMake(0,0)], UITextAttributeTextShadowOffset,     [UIFont fontWithName:@"Helvetica" size:18.0], UITextAttributeFont, nil]    forState:UIControlStateNormal];


for(UIViewController *tab in  self.tabBarController.viewControllers){          [tab.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:  [UIFont fontWithName:@"Helvetica" size:20.0], UITextAttributeFont, nil]  forState:UIControlStateNormal];}


IN Swift 2.0

override func viewDidLoad() {    super.viewDidLoad()   let appearance = UITabBarItem.appearance()   let attributes: [String: AnyObject] = [NSFontAttributeName:UIFont(name: "American Typewriter", size: 12)!, NSForegroundColorAttributeName: UIColor.orangeColor()]   appearance.setTitleTextAttributes(attributes, forState: .Normal)}

In Swift 3.0

override func viewDidLoad() {    super.viewDidLoad()    let appearance = UITabBarItem.appearance()    let attributes: [String: AnyObject] = [NSFontAttributeName:UIFont(name: "American Typewriter", size: 12)!, NSForegroundColorAttributeName: UIColor.orange]    appearance.setTitleTextAttributes(attributes, for: .normal)}