如何在当前位置旋转CALayer?
答案 0 :(得分:0)
我使用了非常相似的代码并且正在旋转。
我将弧度指定为浮点数的差异,并且您缺少用于显示图层的视图的分配。
- (void)spinLayer:(CALayer*)layer { // Create a new spinning animation CAAnimation* spinningAnimation = [self animationForSpinning]; // Assign this animation to the provided layer's opacity attribute. // Any subsequent change to the layer's opacity will // trigger the animation. [layer addAnimation:spinningAnimation forKey:@"opacity"]; // So let's trigger it now layer.opacity = 0.99; [self.contentView.layer addSublayer:layer]; }