Detect/Handle view coming back into focus

Discussion in 'iOS Programming' started by MontyClift, Sep 6, 2008.

  1. MontyClift macrumors newbie

    Sep 2, 2008
    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.
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    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.
  3. MontyClift thread starter macrumors newbie

    Sep 2, 2008
    Perfect, thanks for that I was trying to use ViewDidLoad which obviously only gets fired on the initial load

Share This Page