Tuesday, July 19, 2011

ViewWillAppear does not get called

When using a UINavigationController, you may be frustrated to find that the viewWillAppear does not get called when it is expected to.  To resolve this, you need to tell the navigation controller to call viewWillAppear.  This may be fixed in the upcoming ios5.  When initializing the navigation controller in your view make sure to call the navigation controller's viewWillAppear in the viewDidLoad.


navController = [[UINavigationController alloc] initWithRootViewController:controllerToAdd];
navController.navigationBar.barStyle = UIBarStyleBlack;
[self.view addSubview:[navController view]];
[navController viewWillAppear:YES];

No comments:

Post a Comment