I have a UITabViewController with three tabs. On one of the tabs, the user taps a button and a new UIViewController controller pops up in Landscape mode (for the user to sign their name using their finger). After the user is finished, they tap a Finish button and finish() is called which closes the signing UIViewController.
The problem I am facing is the screen that the user returns to that was in Portrait mode is now in Landscape mode even though the screen is set:
override var supportedInterfaceOrientations: UIInterfaceOrientationMask{
return .portrait
}
override var shouldAutorotate: Bool {
return true
}
and there nothing I can do to force rotation back to portrait. I have read posts such as: How to force device rotation in Swift? and as I understand it, there is nothing I can do to rotate the screen back to portrait?
It's really simple. Write the following code and change orientation value in ViewControllers you want to programmatically rotate.