Rotating only affect one time in iPad in swift 3

不羁的心 提交于 2019-12-12 04:06:20

问题


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.



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


回答1:


Add the below functions to your video view controller :

override var shouldAutorotate: Bool {
    return true
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return .landscape
}


来源:https://stackoverflow.com/questions/46127376/rotating-only-affect-one-time-in-ipad-in-swift-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!