5
votes

I made an app that supports both landscape and portrait mode on the first view controller (the one that gets presented right after the launch screen). I can launch this app in portrait mode, rotate it to landscape, and back to portrait without any problem. But whenever the app is initially launched in landscape mode, it behaves very strangely. An easy workaround that I came up with is to force the app to launch in portrait mode and then let the user be able to rotate it to landscape after it starts.

Any way to accomplish this?

I am on Xcode 8.3, iOS 10.3, the device I am testing my app is an iPad Pro 12.9 in.

1
Did you find any way to do this smoothly?Mamta

1 Answers

-1
votes

Try this on your AppDelegate func viewDidFinishLaunchingWithOptions or in your ViewDidAppear in your viewController

Swift:

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