[英]How to add device orientation to project programmatically in Swift?
No, not exactly.不,不完全是。 You need to set up all the possible user interface orientations your app's view controllers MIGHT support in info.plist.
您需要在 info.plist 中设置应用程序视图控制器可能支持的所有可能的用户界面方向。 Once you've done that there are view controller methods the system calls to see what orientations an individual view controller supports.
完成后,系统会调用视图控制器方法来查看单个视图控制器支持哪些方向。 (See
supportedInterfaceOrientations
in the docs.) (请参阅文档中的
supportedInterfaceOrientations
。)
As of iOS 8 we're not supposed to use rotation methods any more, so check the docs carefully.从 iOS 8 开始,我们不应该再使用旋转方法,因此请仔细检查文档。 It looks to me like
supportedInterfaceOrientations
is still supported, but the willRotate...
, willAnimateRotation...
, didRotateFromInterfaceOrientation
, etc, are deprecated.在我看来,
supportedInterfaceOrientations
仍然受支持,但willRotate...
、 willAnimateRotation...
、 didRotateFromInterfaceOrientation
等已弃用。
I suggest reading about user interface rotation in the UIViewController class reference (in Xcode or in Apple's online documentation on the web.)我建议在 UIViewController 类参考(在 Xcode 或 Apple 在网上的在线文档中)阅读有关用户界面旋转的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.