float degrees = -30.0;
float radians = (degrees/180.0) * M_PI;
[UIView animateWithDuration:0.5 animations:^
{
bottomRoundedView.transform = CGAffineTransformMakeRotation(radians);
}
];
答案 0 :(得分: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"];