iOS 通过添加动画让一个view不停的旋转

    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];

你可能感兴趣的:(iOS 通过添加动画让一个view不停的旋转)