iOS 通过添加动画让一个view不停的旋转
2016-09-12 本文已影响715人
苏坡乔
UIImageView *imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cateringzone"]];
[self.view addSubview: imageview];
CABasicAnimation *layer = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
layer.toValue = @(2*M_PI);
layer.duration = 5;
layer.removedOnCompletion = false;
layer.repeatCount = MAXFLOAT;
[imageview.layer addAnimation:layer forKey:nil];