You can try that : Device.swift
Use contains()
to check that your device type name include "iPad". So, it will do for all iPad Devices
1. Drag UINavigationItem and put at your view controller navigation bar at storyboard.
2. Connect that UINavigationItem with the Outlet that is your code.
@IBOutlet weak var rightNavItem : UINavigationItem!
override func viewDidLoad() {
super.viewDidLoad()
guard let navController = self.navigationController else{
print("Navigation Controller is nil")
return
}
navController.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "HelveticaNeue", size: 25)!, NSForegroundColorAttributeName: UIColor.black]
//This code is for rightbarbutton
rightNavItem.rightBarButtonItem?.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "HelveticaNeue", size: 10)!, NSForegroundColorAttributeName: UIColor.blue], for:.normal)
//.selected or .normal or .disable
}
That's all I got for now. Other feedbacks are also welcome on customizing UINavigationItem. If I can find new one which is better than this, I will update here. Good Luck.
Here is the result :
