博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IOS 永远保持横竖屏方法
阅读量:6885 次
发布时间:2019-06-27

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

1,PortraitViewController 不旋转,保持竖屏

//iOS 5- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{	return (toInterfaceOrientation == UIInterfaceOrientationPortrait);}//iOS 6- (BOOL)shouldAutorotate{	return NO;}- (NSUInteger)supportedInterfaceOrientations{	return UIInterfaceOrientationMaskPortrait;}- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{	return UIInterfaceOrientationPortrait;}
2.
LandscapeViewController 始终保持横屏

//iOS 5- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{	return (toInterfaceOrientation == self.preferredInterfaceOrientationForPresentation);}//iOS 6- (BOOL) shouldAutorotate{	return YES;}- (NSUInteger)supportedInterfaceOrientations{	return UIInterfaceOrientationMaskLandscapeRight;}- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{	return UIInterfaceOrientationLandscapeRight;}

转载于:https://www.cnblogs.com/android88/p/3602600.html

你可能感兴趣的文章
IP协议
查看>>
三表联查
查看>>
ubuntu redis 安装 &基本命令
查看>>
迅速读懂:Effective STL (二)
查看>>
九章算术卷第七 盈不足
查看>>
spring +springmvc+mybatis组合applicationContext.xml文件配置
查看>>
2018年4月17日笔记
查看>>
2440-串行口
查看>>
283-移动零
查看>>
nodejs+express+mongodb写api接口的简单尝试
查看>>
grub密码
查看>>
说好的不熬夜呢???!!!! -- 超市项目
查看>>
Apache遇到的问题:APR not found
查看>>
运行webpack-dev-srerver 端口占用错误及解决办法
查看>>
html-php深入理解
查看>>
第 11 章 日志管理 - 088 - Docker 如何支持多种日志方案?
查看>>
课后作业-----输入法评价
查看>>
使用qemu
查看>>
静态页之间传值
查看>>
01.Hibernate快速入门
查看>>