iOS 动画无限循环CPU占用过高处理

xiaoxiao2021-02-28  29

#define WS(weakSelf)  __weak __typeof(&*self)weakSelf = self; - (void)startAnimation {     WS(weakSelf);     CGAffineTransform endAngle = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));     [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{         self.ImageView.transform = endAngle;     } completion:^(BOOL finished) {         angle += 2;         [weakSelf performSelector:@selector(startAnimation) withObject:nil afterDelay:0.01];     }]; }

用上weakSelf就好了 ,代码参考

转载请注明原文地址: https://www.6miu.com/read-2624557.html

最新回复(0)