my iOS Application should be Portrait all the time by default, even if you rotate your device, it should stay Portrait. This is defined in the info.plist.
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
Now I want to implement, that only in 1 ViewController there is a Button, that changes the screen to Landscape, like so:
var value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
UIViewController.attemptRotationToDeviceOrientation()
but because of the info.plist settings, this does not work. If I remove the property in info.plist, these lines will work, but then the rest of the application will change to landscape, if I rotate the device, which I don't want.
How would you approach and fix this issue?
Can you even support Landscape that is only triggered by Button click?
Thanks in advance!