简体   繁体   English

屏幕旋转处理iOS

[英]screen rotation handling ios

App comprises 5 pages with mesh like hierarchy ie each page can be reached from any page. 应用程序包含5个页面,这些页面具有类似于网格的层次结构,即可以从任何页面访问每个页面。 Each page have portrait and landscape orientation support. 每个页面都有纵向和横向支持。

So i am not able to handle the rotation when pushing and poping the view controllers from navigation controller. 因此,当从导航控制器中推和弹出视图控制器时,我无法处理旋转。

Can any one suggest me the required approach which can be useful in implementing the above. 任何人都可以向我建议所需的方法,这对实现上述目标很有用。

thanks. 谢谢。

This is probably a problem with iOS 6. UINavigationController does not automatically call supportedInterfaceOrientations: unless you tell it to. 这可能是iOS 6的问题。除非另行通知,否则UINavigationController不会自动调用supportedInterfaceOrientations:

Check out the answers to this question . 查看此问题的答案。

Creating a category seems like the best solution. 创建类别似乎是最好的解决方案。

@implementation UINavigationController (iOS6OrientationFix)

-(BOOL) shouldAutorotate {
    return [self.topViewController shouldAutorotate];
} 

-(NSUInteger) supportedInterfaceOrientations {
    return [self.topViewController supportedInterfaceOrientations];
}

@end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM