自动停止ios5生命周期事件

我所有的视图控制器都扩展了我自己的BaseViewController:UIViewController,并在这里覆盖

- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers {
    return NO;
}

然而,iOS 5模拟器已经决定忽略这一点,并继续在我的嵌套UIViewController层次结构上调用我的viewWillAppear等方法。

我在另一个项目中做了同样的事情,它工作得很好。 有什么我想念它让我听吗?


原来你也必须使用这种方法:

UIViewController addChildViewController

所以通过这样做:

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

..并自动返回NOForwardAppearanceAndRotationMethodsToChildViewControllers

...它停止两次调用视图生命周期方法。

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

上一篇: stopping ios5 lifecycle events automatically being called

下一篇: Vim: Use tabs for indentation, spaces for alignment with C source files