Force device rotation works for iPhone but not iPad

override func viewDidAppear(_ animated: Bool) {
     super.viewDidAppear(animated)
     let value = UIInterfaceOrientation.landscapeLeft.rawValue
     UIDevice.current.setValue(value, forKey: "orientation")
}

 

The above snippet of code works just fine when executed on any iPhone running iOS 12. But this will not work for any iPad running iOS 12. All device orientations are supported. Is there a way to force the device rotation, on a single View Controller, for both iPhone and iPad? Thank you!

Powered by WPeMatico

About

You may also like...

Comments are closed.