Search code examples
iosswift3navigationitem

Restore original back button behavior


In a UIViewController viewDidLoad method I customize icon and behavior of the navigation left button this way:

let backButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.action, target:self, action:#selector(handleBack))
self.navigationItem.leftBarButtonItem = backButton

Is there any way to restore its original appearence and behavior?

enter image description here


Solution

  • self.navigationItem.leftBarButtonItem = nil
    self.navigationItem.hidesBackButton = NO