UIImagePickerController in landscape on iPhone OS >= 3.2

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-04-02T21:15:48Z Indexed on 2010/04/02 21:23 UTC
Read the original article Hit count: 1001

Filed under:
|
|

Here is the problem. I have to open the UIImagePickerController in landscape. At this phase I am doing the app for iPhone but it will be soon adjusted for iPad.

The classical way to force the UIImagePickerController to open in landscape would be to use this solution.

But this solution has a problem, specially for iPad, that is the line,

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

because Apple rejects an application for doing that, as they don't want you to set an orientation, because if the user is holding the iPad on landscapeLeft the controller will appear upside down. Apple want you to use your paranormal powers and open the controller the right way for the user.

The only problem is this:

  1. My controller is to appear when the application starts
  2. At this time, the orientation information is not yet available, because it takes a while for the device to discover its orientation;
  3. I've tried to get around this using the accelerometer to discover the orientation, but the accelerometer data is not yet available too when the app starts.

I could make a routine to delay the application until the orientation is available, showing a black screen to the user in the mean time, or a beach ball, but I wonder if there's a more elegant way to do that!

thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk