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.
- 用户经常旋转自己的设备至横向,因为他们希望“看到更多”。如果您只是以比例放大内容的方式响应用户,那就未能达到用户的期望。相反,你应该重新调整文本的换行线,有必要的话,重新安排用户界面的布局,以便让更多的内容显现在屏幕上。