I am trying to build an app in Swift 5 which has a locked VC in potrait mode. In the next VC i want the orientation to support all orientations. I have tried several different solutions and none of them seem to work. I don't have Navigation Controller or TabBar. My application is now locked in potrait on both VC:s. I do support different device orientations in the general settings tab.
This is my current code in AppDelegate:
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.all
}
First VC:
override var shouldAutorotate: Bool {
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return UIInterfaceOrientation.portrait
}
Second VC:
override var shouldAutorotate: Bool {
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.all
}