How to Force iPhone to Check Orientation

Posted by Shannon A. on Stack Overflow See other posts from Stack Overflow or by Shannon A.
Published on 2010-03-23T18:19:01Z Indexed on 2010/03/23 18:23 UTC
Read the original article Hit count: 521

Here's the problem:

View Controller #1 only runs in the two landscape orientations.

View Controller #2 runs in any orientation.

When view controller #2 is pushed on top of view controller #1 (using presentModalViewController:animated:, as it happens), there's no check for orientation. Instead, VC #2 just assumes the orientation is whichever landscape orientation VC #1 is currently in.

This behavior is incorrect if the user happens to be holding the iPhone in a portrait orientation, despite the fact that he's viewing VC #1 where it's not supported. This can easily happen during startup, so it's not just a theoretical question.

Is there any way to tell VC #2 to recheck what it's orientation actually is? If so, where would it be best placed? viewDidLoad?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about orientation