旋转时如何切换视图 [英] How to switch views when rotating

查看:38
本文介绍了旋转时如何切换视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 NavigationController 并且有一个特定的视图,当切换到横向模式时,该视图布局不佳.我制作了该视图的横向优化"版本,当用户旋转 iPhone 时,我想从 Portait 版本切换到横向版本.原因是我在经典计算器 3 x 3 + 1 格式中有 0 - 9 被隐藏了.

I'm using a NavigationController and have a particular View that does not lay out well when switched to Landscape mode. I've made a "landscape optimized" version of that view and when the user rotates the iPhone, I'd like to switch from the Portait version to the Landscape version. The reason is I have 0 - 9 in classic calculator 3 x 3 + 1 format which gets hidden.

我以为我可以使用 WillRotate 执行此操作并将当前视图从 NavigationController 堆栈中弹出并推送替换,但这会引发异常.

I thought I might be able to do this with the WillRotate and pop the current view off the NavigationController stack and push the replacement on, but that's throwing an exception.

有什么想法吗?我希望它是动画的,如果可能的话,让用户看起来不太明显.

Any ideas? I'd like it to be animated and if possible make this not seem obvious to the user.

推荐答案

试试这个...

http://github.com/escoz/monotouch-controls/blob/master/UICatalog/RotatingViewController.cs

这篇关于旋转时如何切换视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆