Stop ios5 life cycle events automatically triggered

All my view controllers extend my own BaseViewController: UIViewController, and in this I redefined

- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers { return NO; } 

However, the iOS 5 simulator decided to ignore this and continues to call my methods viewWillAppear, etc. on my nested hierarchy UIViewController.

I did the same in another project and it worked fine. Is there anything else I'm missing to get him to listen to me?

+7
source share
1 answer

In addition, you should also use this method:

 UIViewController addChildViewController 

So by doing this:

 [self addChildViewController:_browserViewController]; [browserView addSubview:_browserViewController.view]; [_browserViewController didMoveToParentViewController:self]; 

.. and return NO from automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers

... it stops presentation lifecycle methods called twice.

+4
source

All Articles