I want to show an alert with Confirmation when user clicks on back button. This is how I\'m trying to add action.
self.navigationItem.hidesBackButton = true
This might help. This wont override back action, but you can do additional task.
Objective c
-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if(self.isMovingFromParentViewController)
{
//On click of back or swipe back
}
if(self.isBeingDismissed)
{
//Dismissed
}
NSLog(@"%d",self.isBeingDismissed);
NSLog(@"%d",self.isMovingFromParentViewController);
}
Swift
override func viewWillDisappear(_ animated: Bool)
{
super.viewWillDisappear(animated);
if self.isMovingFromParentViewController
{
//On click of back or swipe back
}
if self.isBeingDismissed
{
//Dismissed
}
}