首页 > 移动平台 > 详细

iOS9竖屏处理方法

时间:2015-12-20 23:46:18      阅读:355      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!