Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何强制iOS应用程序以纵向模式启动_Ios_Ipad_Orientation - Fatal编程技术网

如何强制iOS应用程序以纵向模式启动

如何强制iOS应用程序以纵向模式启动,ios,ipad,orientation,Ios,Ipad,Orientation,我制作了一个应用程序,在第一个视图控制器上支持横向和纵向模式(在启动屏幕后立即显示)。我可以在纵向模式下启动此应用程序,将其旋转到横向模式,然后返回纵向模式,没有任何问题。但是,每当应用程序最初以横向模式启动时,它的行为都非常奇怪。我提出的一个简单的解决方法是强制应用程序以纵向模式启动,然后让用户能够在启动后将其旋转到横向 有没有办法做到这一点 我使用的是Xcode 8.3,iOS 10.3,我正在测试我的应用程序的设备是iPad Pro 12.9英寸。在你的AppDelegate func V

我制作了一个应用程序,在第一个视图控制器上支持横向和纵向模式(在启动屏幕后立即显示)。我可以在纵向模式下启动此应用程序,将其旋转到横向模式,然后返回纵向模式,没有任何问题。但是,每当应用程序最初以横向模式启动时,它的行为都非常奇怪。我提出的一个简单的解决方法是强制应用程序以纵向模式启动,然后让用户能够在启动后将其旋转到横向

有没有办法做到这一点


我使用的是Xcode 8.3,iOS 10.3,我正在测试我的应用程序的设备是iPad Pro 12.9英寸。

在你的AppDelegate func ViewDid Finish Launching with Options或在你的ViewDid中出现在你的viewController中

斯威夫特:

let value = UIInterfaceOrientation.LandscapeLeft.rawValue
UIDevice.currentDevice().setValue(value, forKey: "orientation")

你有没有找到什么办法让这一切顺利进行?