I am trying to change the Back button within the UINavigationController
. This is what I tried so far and the output:
1
Code within the ViewDidLoad
self.navigationController?.navigationBar.backIndicatorImage = UIImage(named: "navBarBackButton")
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "navBarBackButton")
self.navigationItem.backBarButtonItem?.image = UIImage(named: "navBarBackButton")
Output:
I tried to add the below but id didn't help:
self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.Plain, target:nil, action:nil)
2
Code within the AppDelegate
let backImg: UIImage = UIImage(named: "navBarBackButton")!
UIBarButtonItem.appearance().setBackButtonBackgroundImage(backImg, forState: .Normal, barMetrics: .Default)
Output:
3
I tried to add the back button in Storyboard
but nothing changed
4 - Thanks to sanandiya vipul. Still need it to be instead of the 'Back'. This only deletes the 'Back but keeps the image lower right side instead of the entire '
UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffsetMake(0, -80.0), forBarMetrics: .Default)
This is the output:
This is the result I am hoping to achieve