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.
精彩评论