iOS9竖屏处理方法

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

时间: 2024-08-26 02:05:39

iOS9竖屏处理方法的相关文章

android设置横屏和竖屏的方法

方法一:在AndroidManifest.xml中配置 假设不想让软件在横竖屏之间切换,最简单的办法就是在项目的AndroidManifest.xml中找到你所指定的activity中加上android:screenOrientation属性.他有下面几个參数: "unspecified":默认值 由系统来推断显示方向.判定的策略是和设备相关的,所以不同的设备会有不同的显示方向. "landscape":横屏显示(宽比高要长) "portrait"

移动端页面自适应横屏竖屏解决方法思考

之前对于横屏的webapp做过一些尝试,但是始终不是很好的解决方案,前段时间又接触了类似的需求,尝试了感觉更好的解决方案. 之前的方法写的博客:移动网页横竖屏兼容适应的一些体会 这里举的例子还是平时常见的移动端的滑动页面,也就是上下切换页面的"H5". 首先要做的准备: 1.html布局 <div id="wrap"> <div class="pageWrap"> <div class="img11&quo

js判断手机浏览器是横屏or竖屏

移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态. 从而根据实际需求而执行相应的程序.通过添加监听事件onorientationchange,进行执行就可以了. //判断手机横竖屏状态: function hengshuping(){ if(window.orientation==180||window.orientation==0){ alert("竖屏状态!") } if(window.orientation==

使用JavaScript判断手机处于横屏还是竖屏

移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态.从而根据实际需求而执行相应的程序.通过添加监听事件onorientationchange,进行执行就可以了. //判断手机横竖屏状态: function hengshuping(){ if(window.orientation==180||window.orientation==0){ alert("竖屏状态!") } if(window.orientation==9

iOS9横竖屏设置的处理方法

在一般的视频类APP播放的时候都会支持横屏,这样做的好处就是便于观看.你的项目中支持横屏吗?我们一起了解一下,在iOS9中横竖屏设置的处理方法吧! 支持横竖屏配置 在iOS6以后,如果APP需要支持横屏,需要在xcode设置中General里面进行勾选配置: 配置完成之后,我们可以看一下Info.plist里面的Supported interface orientations选项也相应的改变了.如下图: 当然,我们也可以直接在Info.plist进行配置. 支持横竖屏方法 在iOS6之前我们可以

cocos2dx怎样设置ios和Android横屏竖屏的几种方法

cocos2d-x编译到ios上.默认是横屏的,若要改为http://竖屏.不同的ios版本号.方法也会不同 在ios7上或许我们设置好了横竖屏.但到了ios6上或许会变化.以下白白给大家分享一下我的做法 转载请注明地址http://blog.csdn.net/u010229677 1.通用的 仅仅须要在RootViewController.mm文件中面 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)

cocos2dx如何设置ios和Android横屏竖屏的几种方法

IOS通用的 只需要在RootViewController.mm文件里面 1 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsPortrait( interfaceOrientation ); } // For ios6, use supportedInterfaceOrientations &

iOS9横屏竖屏设置

公司App里面有个需求,即所有界面都是竖屏,且不允许横屏切换,唯独有一个播放视频的界面允许横屏,大家都知道视频播放适配最大的播放屏幕那样是最好的.从网上多方查找资料,查到了这么一篇文章: 最终,根据此需求处理如下: 首先,确保App本身应该允许转屏切换: 我的App里面UITabBarController是根视图控制器,所以首先创建一个UITabBarController的子类,并设定允许转屏: (这些要放在根视图控制器里面, 如果你的应用根视图是UINavigationController,

android Activity 的生命周期 以及横屏竖屏切换时 Activity 的状态变化

生命周期Android 系统在Activity 生命周期中加入一些钩子,我们可以在这些系统预留的钩子中做一些事情.例举了 7 个常用的钩子:protected void onCreate(Bundle savedInstanceState)protected void onStart()protected void onResume()protected void onPause()protected void onStop()protected void onRestart()protecte