iPhone定位管理:最有效的方法是什么? [英] iPhone orientation management : what is the most efficient way to do?

查看:158
本文介绍了iPhone定位管理:最有效的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要开发一个iPad应用程序,它应该管理两种方向模式(横向和纵向)。
根据官方Apple iOS文档,有两种方法可以继续。

I need to develop an iPad application which should manage the two orientation mode (landscape and portrait). According the official Apple iOS documentation, there are 2 ways to proceed.

- 第一个包括在旋转事件时调整views元素收到了。主要的优点是我们只有一个ViewController
-第二个包括为每个方向显示一个特定的ViewController。因此,我们有2个ViewControllers。

-The first one consists in adjusting views element when the rotation event is received. The main advantage is that we had only one ViewController -The second one consists in displaying a specific ViewController for each orientation. Therefore, we have 2 ViewControllers.

第二种方法看起来不错,但我担心需要的ViewController数量。更重要的是,ViewControllers中的数据同步逻辑必须复制(或与ViewController隔离)才能在两个方向上使用。

The second approach seems to be nice, but I'am afraid by the numbers of ViewController that will be needed. What's more, the "data synchronisation logic" in the ViewControllers will have to be duplicated (or isolated from the ViewController) to be used in both orientation.

我需要的应用程序开发将包含许多完全自定义元素和许多ViewControllers。

The application I need to develop will contain many "full custom elements" and many ViewControllers.

如果有人有建议或经验反馈,我们将非常感激;)

If anyone has advices or experience feedback, it would be really appreciated ;)

感谢您的阅读!

推荐答案

第二种方式应该是:使用2种不同的观点(一个用于纵向,一个用于横向)并在中交换视图控制器的视图willRotateToInterfaceOrientation:。无需复制数据逻辑。

The second way should rather be: using 2 different views (one for portrait, one for landscape) and swapping the view controller's view in willRotateToInterfaceOrientation:. No need to duplicate your data logic.

使用哪种方式?我会说:这取决于。

Which way to use? I would say: it depends.


  • 如果景观和肖像模式的区别仅在于视图的位置/大小,我会使用第一个(加上你会得到)框架的漂亮动画改变了)

  • 如果风景和肖像太不同,我更喜欢第二个。

这篇关于iPhone定位管理:最有效的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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