首页 > 代码库 > Xcode--创建动画

Xcode--创建动画

1.动画(头部-开始动画)[UIView beginAnimations:nil context:nil];2.设置动画的执行时间[UIView setAnimationDuration:1.0];3.向上移动// CGPoint tempCenter = _btn.center;CGRect tempFrame = _btn.frame;tempFrame.origin.y -= 50;_btn.frame = tempFrame;  3.左旋转45°   (transfrom 变形,改造)//_btn.transfrom = CGAffineTransformMakeROtation(- M_PI_4);_btn.transform = CGAffineTransformRotate(_btn.transform,- M_PI_4);4.变大//_btn.transform = CGAffineTransformMakeScale(1.2, 1.2);_btn.transform = CGAffineTransformScale(_btn.transform, 1.2, 1.2);5.透明度 (0-1)_ben.alpha = 1;6.动画(尾巴-提交动画-执行动画)[UIView commitAnimations];//清空之前所有的形变状态(消除以前的旋转、缩放等状态)_btn.transform = CGAffineTransformIdentity;方法二:[UIView animateWithDuration:1.0 animations:^{    rowView.frame = CGRectMake(0,20,100,40);    rowView.alpha = 1;}];[UIView animateWithDuration:1.0 animations:^{    rowView.frame = CGRectMake(0,20,100,40);    rowView.alpha = 1;} completion:^(BOOL finished){ //动画执行完毕后会自动调用这个block    NSLog(@“哈哈”);}];

 

Xcode--创建动画