Это может быть старый вопрос, но он находится в верхней части результатов поиска по теме. Вот более обрезанное и сухое решение: (обязательно импортируйте QuartzCore / QuartzCore.h)
CABasicAnimation *rotation;
rotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotation.fromValue = [NSNumber numberWithFloat:0];
rotation.toValue = [NSNumber numberWithFloat:(2*M_PI)];
rotation.duration = 1.1; // Speed
rotation.repeatCount = HUGE_VALF; // Repeat forever. Can be a finite number.
[yourView.layer addAnimation:rotation forKey:@"Spin"];
Затем, чтобы остановить удалить / сбросить анимацию: (см. Комментарии для остановки на месте)
[yourView.layer removeAnimationForKey:@"Spin"];
В быстром:
let rotation = CABasicAnimation(keyPath: "transform.rotation")
rotation.fromValue = 0
rotation.toValue = 2 * M_PI
rotation.duration = 1.1
rotation.repeatCount = Float.infinity
view.layer.addAnimation(rotation, forKey: "Spin")