1

I noticed that this problem discussed elsewhere, and I've tried a number of solutions such as adding:

- (void)navigationController:(UINavigationController *)navigationController 
   willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
{
    [viewController viewWillAppear:animated];
}

Another solution is to call them manually!

The problem is, in both cases, that when i load modal view controller in the view, things appear to work normally, and this results in calling the viewWillAppear twice!

Why it is working when I load the modal view controller? and is there a better solution to this?

willcodejavaforfood
  • 43,223
  • 17
  • 81
  • 111
user458336
  • 35
  • 5
  • You can see [this article](http://stackoverflow.com/questions/3952900/iphone-addsubview-doesnt-call-willviewappear), I think it is the same problem as yours. – AechoLiu Oct 17 '10 at 12:47
  • I'm using navController pushViewController, yet it dose not result in calling viewWillAppear at the begging, but it call it when i load a modal view controller, and the views behave as expected afterward! – user458336 Oct 17 '10 at 13:04
  • Generally, I will use [self.navigationController pushViewController:childView], not the navController from [UIApplication sharedApplication].navController. Sometimes, they are not the same navigationController. – AechoLiu Oct 17 '10 at 23:27
  • Yes I'm using that, still viewWillAppear never been called till I load a modal view controller! Please note that I have UITabBarController designed in the IB, with the controller responsible for creating the UINavigationController added also in the IB. – user458336 Oct 18 '10 at 10:18
  • To initialize the controllers, i was using [self.view addSubview:navController.view], I removed it and extends UINavigationController, and called [self pushViewController:someViewController animated:NO] instead, and It did work! Thanx for the help! – user458336 Oct 18 '10 at 11:10

0 Answers0