OpenGL ES, UIView and Status Bar mess

Posted by sfider on Stack Overflow See other posts from Stack Overflow or by sfider
Published on 2010-04-23T13:39:58Z Indexed on 2010/04/23 13:43 UTC
Read the original article Hit count: 432

I have iPhone (iPhoneOS 3.x) OpenGL ES app that:

  • can be in landscape/portrait orientation
  • can be with/without status bar shown

I do this by changing status bar orientation and hidden state, then updating OpenGL view frame so it won't overlap status bar and setting projection matrix appropriately.

OpenGL view is in portrait orientation at all time. View controller's shouldAutorotateToInterfaceOrientation: method returns false always, so the status bar won't start autorotating when app is in landscape mode.

The problem I have is that I want to use some other UIViews, like: UIWebView, MFMailComposeView, MPMediaPicker.

I could show them as modals, but this this have some drawbacks:

  • views will always show in portrait orientation, even if they support landscape orientation
  • views will not autorotate, even if they support it

What I do is I take OpenGL view of the window with removeFromSuperview, set transform to the other view so it will be in portrait/landscape orientation when it shows up and place the other view on the window with addSubview:.

This works fine without the status bar, but with it there are some problems I cannot work out:

  • MPMediaPicker is sized to fit under status bar, but it slides under it anyway
  • MFMailComposeView does not show navigation bar until it autorotates on device orientation change

Does anyone has an idea how can I get it to work?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk-3.0