WEB开发网
开发学院手机开发iPhone 开发 iOS如何处理设备方向变化 阅读

iOS如何处理设备方向变化

 2010-12-19 07:19:19 来源:WEB开发网   
核心提示:first half of the rotation would be 90 degrees.The window calls the view controller’s didAnimateFirstHalfOfRotationToInterfaceOrientation:method.Container view
first half of the rotation would be 90 degrees.

The window calls the view controller’s didAnimateFirstHalfOfRotationToInterfaceOrientation:method.

Container view controllers forward this message to the currently displayed custom view controller.

The window calls the view controller’swillAnimateSecondHalfOfRotationFromInterfaceOrientation:duration: method.

Container view controllers forward this message to the currently displayed custom view controller.

The window performs the second half of the rotation.

By the end of this rotation, the autoresizing behaviors for all views have been applied and the views are in their “final” position.

The window calls the view controller’s didRotateFromInterfaceOrientation: method.

Container view controllers forward this message to the currently displayed custom view controller. You can use this method to show views, reposition or resize views, or make other changes once the rotation has finished.

Figure 2-8 shows a visual representation of the preceding steps. Along with each step, it shows how the view would appear to the user.

Figure 2-8 Processing a two-step interface rotation

Creating an Alternate Landscape Interface

If you want to present the same data differently based on whether a device is in a portrait or landscape orientation, the way to do so is using two separate view controllers. One view controller should manage the display of the data in the primary orientation (typically portrait) while the other manages the display of the data in the alternate orientation. Using two view controllers is simpler and more efficient than making major changes to your view hierarchy each time the orientation changes. It allows each view controller to focus on the presentation of data in one orientation and to manage things accordingly. It

上一页  3 4 5 6 7 8 9 10 11  下一页

Tags:iOS 如何 处理

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接