iphone:Handling-orientation-changes
出自UXGuide.net
请帮助我们修订和更新本文的译文部分
本文的译文部分可能是由多个贡献者提供或从不同的渠道收集,未经过最终审阅和整理,请您帮助我们一起修订和更新本文的译文部分。
处理方向变化
Handling Orientation Changes
Users can rotate iPhone OS–based devices at any time, and they expect the content they’re viewing to respond appropriately. In your iPhone application, be sure to:
用户随时可能旋转基于iPhone操作系统的设备,他们希望他们正在浏览的内容随之作出适当调整。在你的iPhone应用程序中,一定要:
- Be aware of accelerometer values (for more information on the accelerometer and references to accelerometer programming interfaces, see iPhone Application Programming Guide). If appropriate, your application should respond to all changes in device orientation.
- 要注意加速度值(要了解更多关于加速度和有关编程接口的参考信息,参见iPhone应用程序编程指南)。如果合适,你的应用程序应响应与设备方向有关的所有变化。
- If there’s a part of your application’s user interface that displays in one orientation only, it’s appropriate for that area to appear in that orientation and not respond to changes in device orientation. For example, when a user selects an iPod video to view, the video displays in landscape orientation, regardless of the current device orientation. This signals the user to physically rotate the device to view the video. The important point about this example is that iPod does not provide a “rotate now” button; instead, the user knows to rotate the device because the video appears in landscape orientation.
- 如果你的应用程序中有一部分用户界面只能在一个方向显示,这个区域只在特定方向上显示,而不响应设备方向的变化,这是合理的。例如,当用户选择观看一个iPod视频,不论当前的设备是什么方向,它都横向显示。这就暗示用户要旋转设备,以便于观看视频。在这个例子中重要的一点是,iPod没有提供“旋转”按钮,而是用户知道要旋转设备,因为视频横向显示。
- Allow users to physically rotate the device to correctly view the parts of your application’s user interface that require a specific orientation. Avoid creating a control or defining a gesture that tells users to rotate the device.
- 允许用户旋转装置以便于正确察看你的应用程序中,那些需要一个明确方向的用户界面。避免为了告诉用户旋转设备而去创建一个控件或定义一个行为。
- Take advantage of the one-step orientation-change process to perform smoother, often faster rotations. However, if your screen layout is very complicated, you might choose instead to perform a cross-fade transition when an orientation-change occurs. To learn how to support the one-step process in your code, see UIViewController Class Reference.
- 充分利用一步操作就能改变方向的进程,来执行顺畅,快速的旋转。然而,如果你的屏幕布局很复杂,当方向发生变化时,你可以选择,而不是执行淡入淡出的过渡。要了解如何在你的代码中支持这个步骤,参见“UIViewControllerClass”参考。
- Users often rotate their devices to landscape orientation because they want to “see more.” If you respond by merely scaling up your content, you fail to meet users’ expectations. Instead, you should respond by rewrapping lines of text and, if necessary, rearranging the layout of the user interface so that more content fits on the screen.
- 用户经常把自己的设备旋转为横向,因为他们希望“看到更多”。如果你只对扩大你的内容做回应,你就不能满足用户的期望。相反,你应该做出回应,重新文本换行,如有必要,重新安排用户界面布局,目的是使更多的内容显示在屏幕上。