0
votes

Probably a simple question, but:

My app starts (and is mostly) in portrait mode, but I have a ViewController which I need to push onto the stack which needs to open in Landscape mode.

I've searched around and found that you can't use the private API: [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeLeft];

I've also found a raft of "suggested" ways of tackling it (including presenting modally instead of pushing, and pushing two instances of the ViewController) Transitioning to landscape rotation within a uinavigationcontroller

However, I'm sure there must be an easier way to tackle this. If anyone knows of a way to PUSH onto the stack (to preserve navigation through the tree), in such a way that the viewcontroller appears landscape, please let me know.

Thanks for all your help guys,

dunc

1
Why are you sure there must be an easier way? Cannyboy's answer to that question looks fairly simple to me.Rog
Thank Roger. You're right, Cannyboy's does work (I tried it before I wrote this post) and I'll probably end up using it. BUT it means the status bar is hidden from that viewcontroller. Any suggestions how I can keep it?theDuncs

1 Answers

2
votes

It makes no sense to use a UINavigationController push transition to present a view in a different orientation. Which way round would the navigation bar / toolbar be?

Presenting a modal view controller is the right way to go about this. If this causes the status bar to become hidden, make sure yourModalViewController.wantsFullScreenLayout is NO.