views:

67

answers:

1

I override -orientationChanged in my main ViewController to push ModalViewController A when the device is in landscape mode. When placed back in portrait mode, ModalViewController A is dismissed. However, there are other cases (after button touches) where ModalViewControllers B, C, or D are shown. When those are showing, if the device is turned landscape and turned back, ModalViewController B C or D is dismissed, inappropriately.

I can verify that -orientationChanged on my main ViewController is being messaged even when a ModalViewController is shown. Is there a condition I can add to my -orientationChanged method to bypass that code when ModalViewController B C or D is being shown?

Thank you!

+2  A: 

You can check if the modalViewController property in your main viewcontroller is one of your view controllers.

Elfred
Thanks, this worked. I used the conditional: if([self.modalViewController isMemberOfClass:[UINavigationController class]]) ...
ed94133