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

iOS如何处理设备方向变化

 2010-12-19 07:19:19 来源:WEB开发网   
核心提示:destination. During the second step, the rotation is rotated from this midpoint to its final orientation. Your application receives notifications throughout the
destination. During the second step, the rotation is rotated from this midpoint to its final orientation. Your application receives notifications throughout the process that allow you to respond before, during, and after the rotation.

The following sequence of events occurs during a two-step rotation:

The window detects that a change in the device orientation has 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 to the currently displayed custom view controller. You can use this method to hide views or make other changes to your view layout before the interface is rotated.

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

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

The window performs the first half of the rotation.

This causes the bounds of each view in the view hierarchy to be adjusted based on its autoresizing behaviors. Although most rotations involve moving from portrait to landscape mode (and thus rotating 45 degrees to the halfway point), it is possible to rotate from a landscape left to landscape right orientation or from a portrait to upside down portrait orientation. In these latter cases, the

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

Tags:iOS 如何 处理

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