views:

1127

answers:

2

First of all, my code isn't complex - in fact it's just two sample programs from "Beginning iPhone Development: Exploring the iPhone SDK", combined into one program. I took the ViewSwitcher application, which switches between a blue view and a yellow view, and replaced the YellowViewController with the CameraViewController from the camera application.

I have three ViewControllers total. SwitchViewController just switches between BlueViewController and CameraViewController.

Inside CameraViewController, I'm trying to use a UIImagePickerController to choose an image. The picker is presented with presentModalViewController. The catch is that I want to do this in landscape orientation.

Everything works fine under 2.2.1, and everything works fine in 3.0 in portrait mode.

In 3.0 under landscape orientation, however, things break. If I set SwitchViewController to landscape orientation, my screen goes white when I try to present the picker. If I rotate the iPhone a few times, I can see a corner of the picker, which apparently was displayed off screen.

If I set CameraViewController to landscape orientation, the picker doesn't come up at all.

I think this page may have a clue when it says "The most prominent change [in 3.0] I can see is that the modal view controller will always use the application frame instead of the parent view controller's frame." I don't understand exactly what that means, though.

Any help is greatly appreciated. Thanks!

A: 

I believe what that means is this: Modal views always use the full screen, even if the parent view controller that invokes them controls a view that is only part of the screen. This makes sense for standard modal views like the camera picker, but I can see why someone who creates a custom modal view might want it to be smaller.

Not sure if that really helps solve your problem though.

Question -- what happens if you bring up the modal view and THEN rotate the phone?

Amagrammer
Good question. If I bring up the modal view and THEN rotate the phone the modal view switches nicely to landscape mode.
niels
A: 

You Must have used "addSubview" in your parent view controller. Try using presentmodalviewcontroller.

I hope , it will solve ur problem :)

Harry