如何在一个视图控制器上旋转屏幕?
我的应用程序正在开发为混合应用程序。
我的问题是如何从当前视图控制器切换到垂直模式?
我的主视图控制器基本上处于垂直模式(固定),如果需要,我需要将其更改为水平模式。
覆盖此功能并将其修复为纵向模式。
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}
无法通过以下功能更改水平模式。
let value = UIDeviceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
你能帮助我吗?
My app is under development as a hybrid app.
My question is how do I switch from the current view controller to vertical mode?
My main view controller is basically in vertical mode (fixed), and if necessary, I need to change it to horizontal mode.
Override this function and fix it in portrait mode.
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .portrait
}
Horizontal mode cannot be changed through the function below.
let value = UIDeviceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
Can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论