PDA

View Full Version : Detect/Handle view coming back into focus




MontyClift
Sep 6, 2008, 04:10 PM
I have an app that uses navigationcontroller.
I'm fine pushing new controllers onto the stack and popping them back.
However I cant figure out how to handle a view being reactivated this way.
So for example if I start on screen a. The users presses a button and screen b pushes in. The user interacts with screen b and then I call
[self.navigationController popViewControllerAnimated:YES];
to get me back out to screen a.
However on screen a reappearing I want to perform some logic but I cant figure out how to capture the actual event that popViewController has created.

Any help greatly appreciated.



robbieduncan
Sep 6, 2008, 04:13 PM
The view controller of the view that appears will get a viewWillAppear and a viewDidAppear message if you implement them. Have a look at the UIViewController documentation.

MontyClift
Sep 6, 2008, 04:15 PM
Perfect, thanks for that I was trying to use ViewDidLoad which obviously only gets fired on the initial load