I am trying to set the tint color of the back button within a navigation controller, but nothing is working. I have tried
[self.navigationController.backBarButtonItem setTintColor:myColor];
//myColor was previously set
But it stays the default tint
It always work for me:
self.navigationItem.leftBarButtonItem = [self logicToAddBackButton];
GET DEFAULT BACK BUTTON
-
BACK BUTTON ACTION
(void)eventBack { [self.navigationController popViewControllerAnimated:YES]; }
UiNavigationBack Image (Please change colour of image as require with same size [25X41 144pixels/inch] to get default look)
What worked for me was this :
Swift way:
It changes all items in the nav.
In AppDelegate do something like this:
If you want to set it to predefined style you can use
If you prefer to do it in Interface Builder without writing code:
It is important to set Back Button appearance this way, and not try to implement leftBarButtonItem, because implementing leftBarButtonItem will disable the built-in back navigation gestures, like swipe to go back.
I believe barButtonItem is read-only. (I'm not too sure about this, someone correct me if I'm wrong)
To give a tint colour to these buttons, this is what I would do:
In your App Delegate, add these lines of code:
The first line sets an appearance proxy, so I believe this works too, if you like less code:
I hope this works for you! (This changes all instances of UIBarButtonItem)