I have view controller A that can modally present view controller B or view controller C, which is a screen we are using to capture a signature. In view controller C, I am using the following code to rotate the screen to landscape:
appDel.shouldRotate = true
let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
UIViewController.attemptRotationToDeviceOrientation()
where in the app delegate I am using
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return shouldRotate ? .landscape : .portrait
}
Normally, I am able to dismiss view controller C without any problems. However, if I restore the app state and display view controller A and present view controller C then proceed to dismiss C, the app returns to the home screen of our app (the initial screen) as opposed to dismissing back to A. The weird thing is that I can present and dismiss view controller B without this problem occurring.
I have commented out my screen rotation logic and I can dismiss view controller C without any problems.
So why does changing the screen's orientation prevent me from going back to view controller A after dismissing C?