在swift 3中,旋转仅在iPad中影响一次 [英] Rotating only affect one time in iPad in swift 3

查看:155
本文介绍了在swift 3中,旋转仅在iPad中影响一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个视图控制器。第一个视图控制器有很多视频,当用户点击视频时,它将进入第二个视图控制器。

I have 2 view controllers. First view controller has many videos and when user clicks on the Video, then it will goes to second view controller.

当用户到达第二个视图控制器时,屏幕将自动旋转到横向模式。

When user reaches to second view controller, then the screen will rotate automatically to the landscape mode.


但是,用户旋转设备,视频显示将旋转为纵向,无法再设置为横向模式。


But, user rotates the device and the video display will rotates to portrait and cannot set to landscape mode anymore.




---------------------

我在Project> General中设置了一些配置。

我想设置任何用户旋转设备的格局。
有人帮我吗?



---------------------
I set some config in Project > General.
I would like to set landscape whatever the user rotates the device. Anyone help me please?

推荐答案

将以下功能添加到视频视图控制器:

Add the below functions to your video view controller :

override var shouldAutorotate: Bool {
    return true
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return .landscape
}

这篇关于在swift 3中,旋转仅在iPad中影响一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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