博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
强制设置页面横竖屏的问题
阅读量:4557 次
发布时间:2019-06-08

本文共 592 字,大约阅读时间需要 1 分钟。

有的时候有的需求会让页面强制的横竖屏转换,再之后的ios的版本中,- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation被官方废弃了,不能继续使用的,下面是ios6之后的强制横竖屏的方法:

-(BOOL)shouldAutorotate

{

    return YES;

}

 

-(UIInterfaceOrientationMask)supportedInterfaceOrientations

{

    return UIInterfaceOrientationMaskLandscape;

}

 

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation

{

    return UIInterfaceOrientationLandscapeRight;

}

 

-(BOOL)prefersStatusBarHidden

{

    return NO;

}

 还有一点需要说明的是,跳转到下一个页面强制横竖屏的时候只能使用presentViewController,而不能使用push跳转的方法,切记!!!

转载于:https://www.cnblogs.com/Acee/p/5007736.html

你可能感兴趣的文章
20180923-WebService
查看>>
z变换
查看>>
Python - 静态函数(staticmethod), 类函数(classmethod), 成员函数
查看>>
Spring基础2
查看>>
【灵异短篇】这个夜晚有点凉
查看>>
一点小问题
查看>>
pytest 10 skip跳过测试用例
查看>>
MVC身份验证及权限管理
查看>>
It was not possible to find any compatible framework version
查看>>
关于8.0.15版本的mysql下载与安装
查看>>
Redis主从复制看这篇就够了
查看>>
洛谷 P1202 [USACO1.1]黑色星期五Friday the Thirteenth 题解
查看>>
(4.20)SQL Server数据库启动过程,以及启动不起来的各种问题的分析及解决技巧...
查看>>
基本数据类型(数字和字符串)
查看>>
函数__装饰器
查看>>
linux system函数分析
查看>>
前端优化措施
查看>>
论学习汉语和学习编程的异同点
查看>>
linux img文件压缩及解压
查看>>
Linux 下的 scp
查看>>