Change BarButtonItem Font Using Swift (Xcode 6)

Swift 3

Another easy way to change all TabBarItems font is using this code in ViewDidLoad() of UITabBarController : (No need to create an Outlet )

UITabBarItem.appearance().setTitleTextAttributes([NSFontAttributeName: UIFont(name: "IranSansMobile", size: 15)!], for: UIControlState.normal)

If you create and outlet (e.g. @IBOutlet var barButton: UIBarButtonItem!) linked to your UIBarButtonItem, you should be able to change your font type by using setTitleTextAttributes on the outlet.

barButton.setTitleTextAttributes([ NSFontAttributeName: UIFont(name: "Arial", size: 12)!], forState: UIControlState.Normal)

Swift3

barButton.setTitleTextAttributes([ NSFontAttributeName: UIFont(name: "Arial", size: 12)!], for: UIControlState.normal)