stopping ios5 lifecycle events automatically being called

All of my view controllers extend my own BaseViewController : UIViewController, and in this i have overridden

- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers {
    return NO;
}

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

I've done the same in another project and it worked fine. Is there something else i'm missing to get it to listen to me?


Turns out you also have to use this method too:

UIViewController addChildViewController

So by doing this:

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

..and returning NO from automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers

... it stops the view lifecycle methods being called twice.

链接地址: http://www.djcxy.com/p/56764.html

上一篇: 如何复制Perl中的符号链接?

下一篇: 自动停止ios5生命周期事件