first time posting, so forgive me if I'm not giving the right info in my question...
I'm creating an app (in swift), and I want to support all screen orientations for all screens (and have set in Xcode general tab accordingly). There's a login / launch screen, and then the root controller for the rest of the app is a UINavigationController.
My problem - The screen keeps rotating back to portrait on any segue, even though the device is in landscape orientation, and the screens all support landscape! Is this the standard behaviour on a segue? And if so, can I prevent it somehow? To be clear - I just want the screen rotation to continue to reflect the device orientation following a segue - and all screens currently support all orientations.
I've tried setting shouldAutorotate to return false for a given screen / view controller, and extended UINavigationController to refer to the visible view controller's shouldautorotate() function, as follows:
extension UINavigationController {
public override func shouldAutorotate() -> Bool {
return visibleViewController!.shouldAutorotate()
}
}
This prevents the rotation away from the (landscape) device orientation on segue, but of course then if the user rotates back to portrait the screen remains landscape...
It seems like this should be really straightforward, but I couldn't find any info or other questions on it, just questions about restricting allowed orientations (I just want the screen orientation to reflect the device orientation at all times)...
One thought - is there a way to detect whether the shouldAutorotate function is being called following a segue? And return false in this instance, but true otherwise?
Any help would be gratefully received!
Thanks
Dan