Background - So in terms of approach at the high level there to me seems to be:
This question is focusing on Option 2 which I was trying to implement.
The Plan - Whilst in a settings type UINavigationController I was going to pass existing (or default) details for one section of the settings from the parent view to the child view when the child view gets pushed onto the stack. The issue is when this data is updated, AND assuming I want to stick with the default Back Button, there does not seem to be a way to intercept the default Back Button, so that when I'm ready to pop the child off the stack just before this I will call a delegate which will pass the latest settings back to the parent.
QUESTION - How to pass updated data from a child controller back to the parent controller when using a UINavigationController and wanting to stick with the default Back Button (with the left arrow thing on it).
That is, probably I have isn't how to pass the data back I guess (I'm going to use a delegate), but rather how to hook into a callback method at the right point of time in the child controller so as to then use the delegate method to pass the data back.
Using Delegate might be the solution for you.
Tutorial can be found:
http://timneill.net/2010/11/modal-view-controller-example-part-2/
which is very helpful for me.
Edit:
UINavigationController "back button" custom text?
and then add method:
[self.navigationController popViewControllerAnimated:YES];
to go back to the previous view. You can then add your own code to that back button.
This gets called every time back button is pressed. But watch out if it goes to another view instead of going back.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With