29,028
社区成员
发帖
与我相关
我的任务
分享
- (void)drawRect:(CGRect)rect
{
CGRect boundingRect = CGRectMake(-100, -100, 300, 300);
CAKeyframeAnimation *orbit = [CAKeyframeAnimation animation];
orbit.keyPath = @"position";
orbit.path = CFAutorelease(CGPathCreateWithEllipseInRect(boundingRect, NULL));
orbit.duration = 4;
orbit.additive = YES;
orbit.repeatCount = INFINITY;
orbit.calculationMode = kCAAnimationPaced;
orbit.rotationMode = kCAAnimationRotateAuto;
[self.layer addAnimation:orbit forKey:@"orbit"];
}
这样做是肯定没问题的