I am developing an application in Swift 2.2. Now I want to change the font and color of the feedback button for a specific view. In this view, there is a navigation controller as the parent controller.
I tried to run both of the following lines in the viewDidLoad of my ViewController
self.navigationController!.navigationItem.backBarButtonItem!.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Andes Rounded", size: 17)!], forState: .Normal) self.navigationItem.backBarButtonItem!.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Andes Rounded", size: 17)!], forState: .Normal)
It does not cause errors, but it does not matter for the back button. I also tried running both of these
self.navigationController!.navigationItem.leftBarButtonItem!.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Andes Rounded", size: 17)!], forState: .Normal) self.navigationItem.leftBarButtonItem!.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "Andes Rounded", size: 17)!], forState: .Normal)
However, this generates an error (zero rollback error). How to change the font and color of the navigation bar button? Feels like I'm not changing the right things ...
ios swift swift2 uinavigationbar
Anton Gildebrand
source share