20160122UIView动画
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了20160122UIView动画相关的知识,希望对你有一定的参考价值。
1.block式动画
横向或纵向移动XY
[UIView animateWithDuration:0.5 animations:^{
self.aView.frame = CGRectMake(_aView.frame.origin.x, _aView.frame.origin.y + 50, _aView.frame.size.width, _aView.frame.size.height);
}];
或者
[UIView animateWithDuration:0.5 animations:^{
//_aView.transform = CGAffineTransformMakeTranslation(0, 20);
_aView.transform = CGAffineTransformTranslate(_aView.transform, 10, 10);
}];
渐变效果
[UIView animateWithDuration:0.5 animations:^{
_aView.alpha = !_aView.alpha;
}];
2.头尾式动画 ---翻页效果
[UIView beginAnimations:nil context:nil] 开始配置动画
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_aview cache:NO];
[UIView commitAnimations] 配置完毕,提交动画
旋转效果
旋转一次
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformMakeRotation(M_PI);
}];
旋转多次
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformRotate(_aView.transform, M_PI_4);
}];
放大效果
[UIView animateWithDuration:0.2 animations:^{
//_aView.transform = CGAffineTransformMakeScale(2, 2);
_aView.transform = CGAffineTransformScale(_aView.transform, 1.1, 1.1);
}];
缩小
[UIView animateWithDuration:0.5 animations:^{
_aView.transform = CGAffineTransformMakeScale(0.5, 0.5);
}];
还原
_PinkView.transform = CGAffineTransformIdentity;
以上是关于20160122UIView动画的主要内容,如果未能解决你的问题,请参考以下文章