zoukankan      html  css  js  c++  java
  • iOS开发动画(Animation)图片360度不停旋转

     1 {
     2     CGFloat angle;
     3 }
     4 
     5 - (void)viewDidLoad {
     6     [super viewDidLoad];
     7     angle = 0;
     8     [self startAnimation];
     9 }
    10 
    11 //方法1
    12 -(void) startAnimation
    13 {
    14     [UIView beginAnimations:nil context:nil];
    15     [UIView setAnimationDuration:0.01];
    16     [UIView setAnimationDelegate:self];
    17     [UIView setAnimationDidStopSelector:@selector(endAnimation)];
    18     self.scanImage.transform = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));
    19     [UIView commitAnimations];
    20 }
    21 
    22 -(void)endAnimation
    23 {
    24     angle += 2;
    25     [self startAnimation];
    26 }
    27 
    28 //方法2
    29 - (void)startAnimation
    30 {
    31     CGAffineTransform endAngle = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));
    32     
    33     [UIView animateWithDuration:0.01 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
    34         self.scanImage.transform = endAngle;
    35     } completion:^(BOOL finished) {
    36         angle += 2; [self startAnimation];
    37     }];
    38 }
  • 相关阅读:
    css3的::selection属性
    css3的apprearance属性(转)
    CSS3的background-size
    DNS与获取
    AMD规范
    网站的个性图标
    webapp之路--之ios上图标
    webapp之路--之必备知识
    用Js的eval解析JSON中的注意点
    CSS 盒模型
  • 原文地址:https://www.cnblogs.com/codemakerhj/p/5462618.html
Copyright © 2011-2022 走看看