我创建了一个视图控制器,然后创建了一个导航控制器:
initWithRootViewController:
然后我观察到它调用pushViewController:animated:
,因为我使用自己的UINavigationController
子类,所以我覆盖pushViewController:animated:
:
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[super pushViewController:viewController animated:animated];
// do something with the VC
}
问题是,紧接着
[super pushViewController:viewController animated:animated];
否,所以我实际上不能做我想做的viewController.isViewLoaded
事,当它用作导航控制器的根 VC 时,有没有办法强制加载 VC?
谢谢!
编辑,下面是代码:
MyViewController *vc = [[MyViewController alloc] initWithNib:@"" bundle:nil];
MyNavController *nav = [[MyNavController alloc] initWithRootViewController:vc];
self.revealViewController.frontViewController = nav;