设置图片不停旋转会卡顿

解决方法为

把函数名里所传需要的参数放到全局变量 即可

- (void)rotateWithSpeed:(CGFloat)spd

{

[UIView animateWithDuration:spd

                          delay:0

                        options:UIViewAnimationOptionCurveLinear

                     animations:^{

                         self.blade.transform = CGAffineTransformRotate(self.blade.transform, M_PI_2);

                     }

                     completion:^(BOOL finished){

                         if (finished) {

                             [self rotateWithSpeed:spd];

                         }

                     }];

}

 

换为

 

- (void)rotateWithSpeed

{

[UIView animateWithDuration:self.spd

                          delay:0

                        options:UIViewAnimationOptionCurveLinear

                     animations:^{

                         self.blade.transform = CGAffineTransformRotate(self.blade.transform, M_PI_2);

                     }

                     completion:^(BOOL finished){

                         if (finished) {

                             [self rotateWithSpeed];

                         }

                     }];

}

 

 

 

posted on 2016-01-09 18:54  aoxer  阅读(619)  评论(0)    收藏  举报