UIView rotation, modal view lanscape and portrait, parent fails to render

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-01-12T11:02:41Z Indexed on 2010/04/06 13:03 UTC
Read the original article Hit count: 689

Hi everyone,

I've hit a bit of a roadblock with something that I hope that someone in here can help me out with. I'll describe the 'state of play' first, and then what the issue is, so here goes;

  1. I have a series of view controllers that are chained together with a Navigation Controller (this works just fine),
  2. All of these view controllers support portrait mode only (by design),
  3. In one of the view controllers (the 'end' one actually) the user can click a table cell to pop up a modal view controller (using presentModalViewController(...) of course)
  4. This modal view controller supports portrait and landscape modes (and this works),
  5. When the user clicks the 'Done' button on this modal view controller we pop and pass control back to the parent view controller, however;
    1. If the user is in portrait mode when they click 'Done' then the parent displays itself just fine,
    2. If the user is in landscape mode when they click 'Done' then the parent displays a totally white, blank screen (that covers the whole screen). It is as if the controller does not know how to render in landscape and just doesn't bother.

I'd like to be able to have this parent view render in portrait no matter what the orientation of the phone is when the user clicks the 'Done' button.

Various forum posts suggest using the UIDevice method 'setOrientation' (but this is undocumented and will get our app rejected apparently). Another suggestion was to set the 'statusBarOrientation' to portrait in the 'viewWillAppear' method but that had no effect.

So I am a bit stuck!

Has any encountered anything like this before? If need be I can provide code, if that will help anyone diagnose the problem for me.

Thanks in advance!

Cheers, Ben

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiview