Swift - 仅允许在iPad上旋转 [英] Swift - Allow Rotation on iPad Only

查看:306
本文介绍了Swift - 仅允许在iPad上旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能允许我在iOS 8.3 SDK上使用Swift编写的通用应用程序仅在iPhone上支持纵向模式,但在iPad上支持纵向和横向模式?

How could I allow my universal app written in Swift on iOS 8.3 SDK to support only portrait mode on iPhone, but both portrait and landscape mode on iPad?

I知道在过去这已经在AppDelegate中完成了。我怎么能在Swift中做到这一点?

I know in the past this has been done in AppDelegate. How could I do this in Swift?

推荐答案

你可以通过编程方式完成,或者更好的是,你可以简单地编辑项目的信息.plist(这应该更实用,因为它是全局设备配置)

You can do it programmatically, or better yet, you can simply edit your project's Info.plist (Which should be more practical, since it's a global device configuration)

只需添加支持的界面方向(iPad)键

Just add "Supported Interface orientations (iPad)" key

这篇关于Swift - 仅允许在iPad上旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆