I am setting the values of the title and back button in the UINavigationBar
as follows:
self.navigationItem.title = @\"Post\";
[self.navigationC
You cannot add target to stock BackButton, but you can override a UINavigationBarDelegate method in your CustomNavigationController, like this:
class CustomNavigationController: UINavigationController {
@IBOutlet weak var ibNavigationBar: UINavigationBar!
override func viewDidLoad() {
super.viewDidLoad()
ibNavigationBar.delegate = self
}
}
extension CustomNavigationController: UINavigationBarDelegate {
func navigationBar(navigationBar: UINavigationBar, shouldPopItem item: UINavigationItem) -> Bool {
for viewController in viewControllers {
if viewController.title == "YourTitledViewController" {
popToViewController(viewController, animated: true)
}
}
return false
}
}