【发布时间】:2017-09-03 15:51:49
【问题描述】:
我想在电影播放时旋转我的视图控制器。
我的问题可能是重复的,但是当我发现堆栈溢出时我尝试了很多方法。但是所有代码都不起作用。可能是我把代码放错了。
override var shouldAutorotate: Bool {
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
//return[.portrait,.landscapeRight]
return .landscapeLeft
}
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
//return UIInterfaceOrientation.landscapeRight
return .landscapeLeft
}
我把这段代码放到 vlcplayerviewcontroller.swift 文件中。
当用户点击播放按钮时,它将转到 vlcplayerviewcontroller.swift,我想自动以横向模式显示电影。我不知道我该怎么做。
我的参考链接是How to lock orientation of one view controller to portrait mode only in Swift。
【问题讨论】:
标签: ios uiviewcontroller swift3 landscape uideviceorientation