Back button method affecting uinavigationbar (iOS)

I have a table view that is pushed to the detail view controller. From the detail view controller, when I press the “back” button, I want an integer value to change. How to Edit the action of the navigation bar back button programmatically. The back button is automatically placed in my application because I am using a table view, so I didn’t actually create a button, so I don’t know how to affect it. < p>

To be clear, I still want the back button to return to the original view, but at the same time change the value of the integer. Thank you!

Thanks PengOne for pointing me in the direction.
Add UINavigationBarDelegate in the header file and add it in the .m Use it in the file:

- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item
{
/ /insert your back button handling logic here
// let the pop happen
return YES;
}

I have a table view , Push to the detail view controller. From the detail view controller, when I press the “back” button, I want an integer value to change. How to programmatically edit the operation of the navigation bar back button. The back button will automatically be put In my application, because I’m using a table view, I don’t actually create a button, so I don’t know how to influence it.

To be clear, I still want to go back The button returns to the original view, but at the same time changes the value of the integer. Thank you!

Thanks to PengOne for pointing me in the direction.
Add UINavigationBarDelegate in the header file and use it in the .m file:

- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item
{
//insert your back button handling logic here
// let the pop happen
return YES;
}

Leave a Comment

Your email address will not be published.