`
zl4393753
  • 浏览: 340364 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

iPhone Dev: UINavigationController and viewWillAppear

 
阅读更多
I recently came across a problem while developing and application that has UINavigationController inside a UITabBarController. When i tried to go back in the navigation menu that viewWillAppear or viewDidAppear function of the parent view was not firing up. I searched the net for the solution but was none were clear. So if you are facing a problem like this then try out the following solution.

1. When calling the next view always call the viewWillAppear before pushing the view in the view hierarchy.
NextView *next = [[NextView alloc] init];
[next viewWillAppear:YES];    // (or NO)
[self.navigationcontroller pushViewController:next animated:YES];

2. When you press the back button and you want to call the viewWillAppear of the previous parent view do the following
[[self.navigationController.viewControllers objectAtIndex:2] viewWillAppear:YES];
[self.navigationController popViewControllerAnimated:YES];

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics