1
float degrees = -30.0;
float radians = (degrees/180.0) * M_PI;

[UIView animateWithDuration:0.5 animations:^
 {
     bottomRoundedView.transform = CGAffineTransformMakeRotation(radians);
 }
 ];
4

1 回答 1

0

试试下面的代码,

CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
pathAnimation.repeatCount = INFINITY;
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
pathAnimation.duration = 3.0;

CGMutablePathRef curvedPath = CGPathCreateMutable();
CGRect circleContainer = CGRectMake(0, 0, 100, 100); 
CGPathAddEllipseInRect(curvedPath, NULL, circleContainer);

pathAnimation.path = curvedPath;
CGPathRelease(curvedPath);

[self.yourbutton.layer addAnimation:pathAnimation forKey:@"myCircleAnimation"];

circleContainer是您需要为其显示圆形动画的帧。 pathAnimation.duration是调整动画的速度。

如果你想停止动画然后调用

[self.yourbutton.layer removeAnimationForKey:@"myCircleAnimation"];
于 2013-10-23T10:39:23.053 回答