码迷,mamicode.com
首页 > 其他好文 > 详细

20160122UIView动画

时间:2016-01-25 21:22:59      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

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动画

标签:

原文地址:http://www.cnblogs.com/yangqinglong/p/5158495.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!