I have a strange bug in my app when my UI flow is as follows:
The mainViewController is launched in Portrait orientation, and in turn it displays a LoginViewController with modalPresentationStyle set to
UIModalPresentationFullScreen
.I turn the loginViewController to landscape mode, enter credentials to login (the methods to authenticate the user are defined in the mainViewController).
The loginViewController is dismissed (from the mainViewController) and a bunch of buttons are loaded onto the screen to indicate that it's the home screen.
Now my problem is that the button positions appear as if the app were in Portrait orientation even though the app was switched to Landscape while the loginViewController was presented.
Moreoever, this happens ONLY when the modalPresentationStyle is set to UIModalPresentationFullScreen
! When I present it as a form sheet or a page sheet, everything works normally (I, however, need my loginViewController to be displayed FullScreen).
So far I've tried manually calling the shouldAutorotate method when the loginViewController is dismissed etc., and that solves the problem but seems like a shoddy workaround rather than a fix.
I've also tried calling the shouldAutorotate method of the mainViewController from the loginViewController, but this changes nothing.
Any ideas on how to fix the issue?