Reputation: 2293
Here is what I have in my viewDidLoad method:
self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back")
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back")
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil)
I am trying to have a custom icon image for my back button in my navigation controller. Instead of the image showing in it's original format, I am seeing the image in blue. How do I get the image to show properly?
Upvotes: 3
Views: 1335
Reputation: 7582
You can use renderingMode
for your custom image with AlwaysOriginal
mode. See below code for solved it.
self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "back")?.imageWithRenderingMode(.AlwaysOriginal)
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "back")?.imageWithRenderingMode(.AlwaysOriginal)
Hope that helps!
Upvotes: 10
Reputation: 1089
Set the tintColor property of the barbuttonItem.
self.navigationItem.backBarButtonItem.tintColor = "any color"
Upvotes: 0
Reputation: 8184
Quickest solution
.navigationController?.navigationBar.tintColor = UIColor.redColor()
Or you can create custom barButton item, with custom view
Upvotes: 1