美文网首页IOS异常问题
[[UIApplication sharedApplicatio

[[UIApplication sharedApplicatio

作者: 零点知晨 | 来源:发表于2017-07-26 18:37 被阅读0次

项目中需要实现单个界面的横屏,通过tranform来旋转屏幕的时候,需要同时旋转一下状态栏。但是直接设置setStatusBarOrientation这个是无效的。

  • 必须保证- (BOOL)shouldAutorotate返回的是NO。
    • 同时,如果是NavgationController的话,需要设置NavgationController的shouldAutorotate,否则也是无效的
- (BOOL)shouldAutorotate {
    return [[self.viewControllers lastObject] shouldAutorotate];
}


- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}

简单记录一下问题。具体可以参考http://blog.csdn.net/ginhoor/article/details/20454229

相关文章

网友评论

    本文标题:[[UIApplication sharedApplicatio

    本文链接:https://www.haomeiwen.com/subject/gppokxtx.html