iOS横竖屏
来源:互联网 发布:网络挣钱路子 编辑:程序博客网 时间:2024/05/21 19:12
iOS APP默认支持四个方向,即Portrait、PortraitUpsideDown、LandscapeLeft、LandscapeRight。在有些画图类、游戏类应用中,需要限制APP仅支持横屏或仅支持竖屏,这就需要在程序中禁止支持其他两个方向。下面以横屏应用为例介绍一下如何进行设置:
首先,在项目的info.plist中去掉竖屏的两个方向,保留横屏方向,如下图所示
然后,在项目中的UINavigationController子类中添加如下代码
- (BOOL)shouldAutorotate
{
return YES;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}
同时记得在General里面修改
1 0
- ios横竖屏解决方案
- ios横竖屏解决方案
- ios横竖屏问题
- ios横竖屏切换
- ios横竖屏解决方案
- iOS横竖屏解决方案
- iOS横竖屏解决方案
- ios 横竖屏控制
- iOS 横竖屏
- IOS横竖屏切换
- iOS横竖屏解决方案
- iOS横竖屏设置
- iOS 强制横竖屏
- iOS横竖屏
- iOS横竖屏问题
- iOS 横竖屏控制
- iOS 横竖屏控制
- IOS 横竖屏切换
- GIS+=地理信息+容器技术(1)——容器技术概述
- android 四大组件 BroadcastReceiver使用
- Android 关于“NetworkOnMainThreadException”出错提示的原因及解决办法
- Android 应用开发(一):搭建 Android 开发环境
- leetcode刷题系列C++-Search in Rotated Sorted Array II
- iOS横竖屏
- Light OJ 1013 Love Calculator (dp)
- GitLab,是一个使用 Ruby on Rails 开发的开源应用程序,与Github类似,能够浏览源代码,管理缺陷和注释,非常适合在团队内部使用。 官方只提供了Debian/Ubuntu系统下的安
- 设计模式--单例模式
- 栈 1
- javascript_词法结构
- Android仿QQ未读消息拖拽删除粘性效果
- Writing Files
- TBB之parallel_for