Pergunta

I have a navigationControll with several views. Everything works properly. I now want to show an alert in the parent view, after i call the method [self.navigationController popViewControllerAnimated:YES]; in the child view. I configured the alert to show on the parent's view controller viewDidLoad. But what i acknowledge is that this is only called the first time the view is called. Is there any method called each time i go back to this view? thks!

Foi útil?

Solução

I had to remove the -(void)viewDidAppear:(BOOL)animated; in order for this to work:

-(void)viewWillAppear:(BOOL)animated
{
  //YOUR CODE HERE (mine was the alert showing up)
}

Now the alert works perfectly.

Outras dicas

You should try -(void)viewDidAppear:(BOOL)animated;. Don't forget to call [super viewDidAppear:animated]; at some point in your implementation.
Another way to catch this event is to use a delegate method :

-(void)navigationController:(UINavigationController *)navigationController
      didShowViewController:(UIViewController *)viewController
                   animated:(BOOL)animated;

You can find more information visiting UINavigationControllerDelegate Protocol Reference.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top