iOS如何处理设备方向变化
2010-12-19 07:19:19 来源:WEB开发网For detailed information about the sequence of steps that occur during the one-step and two-step rotation processes, see “Responding to Orientation Changes.”
Declaring the Supported Interface Orientations
If the view managed by your view controller supports orientations other than the default portrait orientation, you must override the shouldAutorotateToInterfaceOrientation: method and indicate which orientations your view supports. You should always choose the orientations your view supports at design time and implement your code with those orientations in mind. There is no benefit to choosing which orientations you want to support dynamically based on runtime information. Even if you did so, you would still have to implement the necessary code to support all possible orientations, and so you might as well just choose to support the orientation or not up front.
Listing 2-4 shows a fairly typical implementation of the shouldAutorotateToInterfaceOrientation: method for a view controller that supports the default portrait orientation and the landscape-left orientation. Your own implementation of this method should be just as simple.
Listing 2-4 Implementing the shouldAutorotateToInterfaceOrientation: method
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
更多精彩赞助商链接
热点阅读最新推荐
飞鹰联盟成员网站 Copyright © 2003-2013 CnCms.Com. All Rights Reserved 京ICP备10000768号
|