第五,UIViewController旋转方法详解

本文介绍了UIViewController在iOS开发中如何处理屏幕旋转的方法,包括是否允许旋转、旋转开始与结束时的操作以及不同阶段的动画控制。

@interface UIViewController (UIViewControllerRotation)


//是否允许旋转

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation; 

// Override to allow rotation. Default returns YES only for UIInterfaceOrientationPortrait



// 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.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值