iPhone定位管理:最有效的方法是什么?

编程入门 行业动态 更新时间:2024-10-27 12:34:52
本文介绍了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定位管理:最有效的方法是什么?

本文发布于:2023-10-25 00:20:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1525402.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最有效   方法   iPhone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!