代码如下
[UIView animateWithDuration:3 animations:^{
[imageview setTransform:(CGAffineTransformMakeTranslation(-600,0))];
[imageview setAlpha:0];
[imageview setAnimationRepeatCount:0];
}
];只能循环平移动画一次?如何一直循环下去

解决方案 »

  1.   

    用CABaseAnimation啊。设置重复次数为最大整数
      

  2.   

    有两种方式:
    这是方法一(你设置重复次数的对象调用错了):
        [UIView animateWithDuration:3 animations:^{
            [self.webView setTransform:(CGAffineTransformMakeTranslation(-600,0))];
            [self.webView setAlpha:0];
            [UIView setAnimationRepeatCount:0];
        }];
        
    这是方法二:
        // 把这个动画封装成一个方法
        [UIView animateWithDuration:3 animations:^{
            [self.webView setTransform:(CGAffineTransformMakeTranslation(-600,0))];
            [self.webView setAlpha:0];
            
        } completion:^(BOOL finished) {
            // 在这里再调用这个方法本身
        }];
      

  3.   

     [UIView setAnimationRepeatCount:0];0 改为MAXFLOAT试下