0
如何在當前位置旋轉CALayer?如何在當前位置旋轉CALayer?
如何在當前位置旋轉CALayer?如何在當前位置旋轉CALayer?
我使用非常相似的代碼,它正在旋轉。
我將弧度賦值爲float並且缺少視圖的賦值以顯示圖層。
- (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]; }