iPhone事件何时旋转?

iPhone事件何时旋转?

问题描述:

在我的应用程序中,我想在我的视图旋转前做一些处理。旋转发生之前是否有事件发生?iPhone事件何时旋转?

谢谢你,艾伦

退房的UIViewController这些方法:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

// Notifies when rotation begins, reaches halfway point and ends. 
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration; 


- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation; 

// Faster one-part variant, called from within a rotating animation block, for additional animations during rotation. 
// A subclass may override this method, or the two-part variants below, but not both. 
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); 

// Slower two-part variant, called from within a rotating animation block, for additional animations during rotation. 
// A subclass may override these methods, or the one-part variant above, but not both. 
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration; 
- (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation; // The rotating header and footer views are offscreen. 
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration; // A this point, our view orientation is set to the new orientation. 

享受

+0

非常感谢您! – 2010-12-19 19:21:19

有许多在UIViewController中的事件被旋转时引发的。旋转之前的以下两个触发器:

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 

“在用户界面开始旋转之前发送到视图控制器。

- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 

“在执行一步用户界面旋转之前发送到视图控制器。”