我有一个UITabBarController,它有几个标签.当我改变应用程序的方向时,在iOS 8中,所有它的viewController的viewDidLoad都会被调用.当我在iOS 7中运行应用程序时,这不会发生.
iOS 8的任何新功能是否会在方向更改时重新加载UITabBarController?
如果是这样我怎么能阻止我的Tabbar重新加载它的视图控制器.
解决方法
Parul Garg是正确的,我遇到了同样的问题.
请注意,启用viewWillTransitionToSize后,您需要手动调用方向更改方法.
-(void) viewWillTransitionToSize:(CGSize)sizewithTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator { //[super viewWillTransitionToSize:sizewithTransitionCoordinator:coordinator]; UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; UIInterfaceOrientation toInterfaceOrientation = orientation; if ([self.selectedViewController isKindOfClass:[UINavigationController class]]) { UINavigationController *navCtrl = (UINavigationController*)self.selectedViewController; UIViewController* NavSubController = [[navCtrl viewControllers] lastObject]; [NavSubController willRotateToInterfaceOrientation:toInterfaceOrientation duration:0.0]; } }