码迷,mamicode.com
首页 > 移动开发 > 详细

iOS9竖屏处理方法

时间:2015-12-20 23:49:05      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:

Xcode升级到7.0,iOS升级到9.0后,发现原来设置不旋转的方法失效了。在网上发现需要如下设置:

1. 在ViewController里面设置

/* iOS6后被废弃了,使用接下来的两个方法,并且要在Deloyment info勾上requires full screen */
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

/* 是否支持旋转 */
- (BOOL)shouldAutorotate {
    return NO;
}

/* 支持的方向 */
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

2. 在AppDelegate插入

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationMaskPortrait;
}

3. 在General里面勾上Requires full screen

技术分享

 

iOS9竖屏处理方法

标签:

原文地址:http://www.cnblogs.com/datou-mars/p/5062142.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!