开发者

Push UIViewController with different orientation to previous

开发者 https://www.devze.com 2023-03-20 03:29 出处:网络
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.

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 inst开发者_开发技巧ances 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号