我在我的tabBarController应用程序中使用了一个带有多个UINavigationControllers的UINavigationControllers,现在我想增加对旋转的支持(在某些视图控制器上,不是全部)。我知道我需要为我的supportedInterfaceOrientation实现UIViewControllers方法。
当设备被旋转时,supportedInterfaceOrientation在UINavigationController上被调用,但是我需要在我的viewControllers上调用它。做这件事最好的方法是什么?
如有任何建议请见谅。:)
发布于 2014-02-18 22:36:19
如果您使用iOS 6+,我建议对UINavigationController进行子类化和重写supportedInterfaceOrientations
类似于:
- (NSUInteger)supportedInterfaceOrientations;
{
return [self.topViewController supportedInterfaceOrientations];
}发布于 2014-02-18 22:38:35
您不需要任何子类。只需在每个应对方向更改作出反应的类中添加通知观察者即可。
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(screenOrientationChanged) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];https://stackoverflow.com/questions/21866880
复制相似问题