rotate a UIView around its center but several times

前端 未结 4 1418
忘了有多久
忘了有多久 2020-12-01 06:43

I\'m trying to rotate some UIView around its center, so the simple code goes something like (in pseudocode):

[UIView beginAnimations:@\"crazyRo         


        
4条回答
  •  执笔经年
    2020-12-01 07:30

    CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    animation.fromValue = [NSNumber numberWithFloat:0.0f];
    animation.toValue = [NSNumber numberWithFloat: 2*M_PI];
    animation.duration = 8.0f;
    animation.repeatCount = INFINITY;
    [self.myView.layer addAnimation:animation forKey:@"SpinAnimation"];
    

提交回复
热议问题