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

iOS如何处理设备方向变化

 2010-12-19 07:19:19 来源:WEB开发网   
核心提示:occurred.The window looks for an appropriate view controller and calls itsshouldAutorotateToInterfaceOrientation: method to determine if it supports the new ori
occurred.

The window looks for an appropriate view controller and calls itsshouldAutorotateToInterfaceOrientation: method to determine if it supports the new orientation.

Container view controllers may intercept this method and use their own heuristics to determine whether the orientation change should occur. For example, the tab bar controller allows orientation changes only if all of its managed view controllers support the new orientation.

If the new orientation is supported, the window calls the view controller’swillRotateToInterfaceOrientation:duration: method.

Container view controllers forward this message on to the currently displayed custom view controller. You can override this method in your custom view controllers to hide views or make other changes to your view layout before the interface is rotated.

The window adjusts the bounds of the view controller’s view.

This causes each view in the view hierarchy to be resized based on its autoresizing mask.

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

Container view controllers forward this message to the currently displayed custom view controller. This marks the end of the rotation process. You can use this method to show views, change the layout of views, or make other changes to your application.

Figure 2-7 shows a visual representation of the preceding steps. It also shows how the interface would look at various stages of the process.

Figure 2-7 Processing a one-step interface rotation

Responding to Orientation Changes in Two Steps

In all versions of iOS, you can use two-step notifications to respond to interface orientation changes. In the two-step process, two separate rotations occur. During the first step, the interface is rotated only halfway to its

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

Tags:iOS 如何 处理

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