문제

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!

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top