I am building a video app. When a user rotates the device to landscape, the video takes over all of the screen and the UI changes.
Is there a way to 'force' landscape layout when the device is in portrait? For example, if the user has orientation lock we want to add a button to enter the landscape mode. The YouTube app has a button that does this.
Yes you can force it using this 2 lines of code, in your viewDidAppear
let value = UIInterfaceOrientation.landscapeLeft.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments