UIView 动画

UIView 动画

需要在frameworks中添加QuartzCore.framework

在接口程序中加上头文件   #import <QuartzCore/QuartzCore.h>

/*好多动画效果*/

UIView动画

[UIViewbeginAnimations:@"animationID"context:nil];

[UIViewsetAnimationDuration:0.5f];

[UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];

[UIViewsetAnimationRepeatAutoreverses:NO];

switch (theButton.tag)

{

case0:

[UIViewsetAnimationTransition:UIViewAnimationTransitionFlipFromLeftforView:self.viewcache:YES];//oglFlip, fromLeft 

break;

case1:

[UIViewsetAnimationTransition:UIViewAnimationTransitionFlipFromRightforView:self.viewcache:YES];//oglFlip, fromRight  

break;

case2:

[UIViewsetAnimationTransition:UIViewAnimationTransitionCurlUpforView:self.viewcache:YES];

break;

case3:

[UIViewsetAnimationTransition:UIViewAnimationTransitionCurlDownforView:self.viewcache:YES];

break;

default:

break;

}

[self.viewexchangeSubviewAtIndex:1withSubviewAtIndex:0];

[UIViewcommitAnimations];


CATransition动画,公开的。

CATransition *animation = [CATransitionanimation];

    //animation.delegate = self;

animation.duration = 0.5f;

animation.timingFunction = UIViewAnimationCurveEaseInOut;

animation.fillMode = kCAFillModeForwards;

//animation.removedOnCompletion = NO;

/*

kCATransitionFade;

kCATransitionMoveIn;

kCATransitionPush;

kCATransitionReveal;

*/

/*

kCATransitionFromRight;

kCATransitionFromLeft;

kCATransitionFromTop;

kCATransitionFromBottom;

*/

switch (theButton.tag) {

case0:

animation.type = kCATransitionPush;

animation.subtype = kCATransitionFromTop;

break;

case1:

animation.type = kCATransitionMoveIn;

animation.subtype = kCATransitionFromTop;

break;

case2:

animation.type = kCATransitionReveal;

animation.subtype = kCATransitionFromTop;

break;

case3:

animation.type = kCATransitionFade;

animation.subtype = kCATransitionFromTop;

break;

default:

break;

}

[self.view.layeraddAnimation:animation forKey:@"animation"];

CATransition动画,这些是private动画,一般还是不要用的好。

CATransition *animation = [CATransitionanimation];

animation.delegate = self;

animation.duration = 0.5f * slider.value;

animation.timingFunction = UIViewAnimationCurveEaseInOut;

animation.fillMode = kCAFillModeForwards;

animation.endProgress = slider.value;

animation.removedOnCompletion = NO;

switch (theButton.tag) {

case0:

animation.type = @"cube";//---

break;

case1:

animation.type = @"suckEffect";//103

break;

case2:

animation.type = @"oglFlip";//When subType is "fromLeft" or "fromRight", it's the official one.

break;

case3:

animation.type = @"rippleEffect";//110

break;

case4:

animation.type = @"pageCurl";//101

break;

case5:

animation.type = @"pageUnCurl";//102

break;

case6:

animation.type = @"cameraIrisHollowOpen ";//107

break;

case7:

animation.type = @"cameraIrisHollowClose ";//106

break;

default:

break;

}

[self.view.layeraddAnimation:animation forKey:@"animation"];


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值