热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

无法锁定iPadAir2的方向-UnabletolockorientationoniPadAir2

TheiOSapplicationIamworkingonhasaviewthatneedstobelockedinlandscapeorientation.Up

The iOS application I am working on has a view that needs to be locked in landscape orientation. Up to this point, that was accomplished by using the shouldAutorotate and supportedInterfaceOrientations methods, but on an iPad Air 2 running iOS9 beta5, these methods never fire and the orientation is not locked.

我正在开发的iOS应用程序有一个视图需要锁定为横向。到目前为止,这是通过使用shouldAutorotate和supportedinterfaceorientation方法来实现的,但是在运行iOS9 beta5的iPad Air 2上,这些方法都不会触发,而且方向也没有锁定。

I have tried on the following devices, methods fired on all except the Air2 (running debug with Xcode beta6): iPhone 6+, iPad Mini, iPad Air 2, iPad 2, iPad 3

我已经尝试了以下的设备,除了Air2(用Xcode beta6运行调试):iPhone 6+, iPad Mini, iPad Air2, iPad 2, iPad 3。

The methods not firing are as follows:

不点火的方法如下:

- (BOOL)shouldAutorotate {
    return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationMaskLandscapeRight;
}

View controller is displayed via presentViewController

视图控制器通过presentViewController显示

3 个解决方案

#1


23  

Multitasking can be turned off by adding the UIRequiresFullScreen field to the application's info.plist with the boolean value YES, and this will allow the orientation delegate methods shouldAutorotate, preferredInterfaceOrientation, and supportedInterfaceOrientations to fire.

可以通过将UIRequiresFullScreen字段添加到应用程序的信息来关闭多任务处理。具有布尔值的plist是YES,这将允许定向委派方法shouldAutorotate, preferredInterfaceOrientation,和支持性的interfaceorito fire。

As far as locking orientation AND supporting multitasking, I have not found a way to do this.

至于锁定定位和支持多任务处理,我还没有找到一种方法。

#2


5  

The 'Requires full screen' setting can be enabled from 'General' of the target settings.

“需要全屏”设置可以从“一般”的目标设置。

Requires full screen

With this enabled, the orientation code will now run. As mentioned by ackerman91, you can also set UIRequiresFullScreen boolean to YES in the application info.plist or in the target 'Info' tab.

启用此功能后,定向代码现在将运行。正如ackerman91所提到的,您还可以在应用程序信息中将UIRequiresFullScreen boolean设置为YES。plist或目标“Info”选项卡。

#3


0  

I am thinking this is collateral damage with the multi-tasking feature. You won't be able to assume anymore that you own the whole screen. There may be other methods to call to disallow the multi-tasking mode.

我认为这是多重任务的附带损害。你不能再假设你拥有整个屏幕。可能还有其他方法来调用不允许多任务模式。


推荐阅读
author-avatar
mobiledu2502885323
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有