如何在当前位置旋转CALayer?
I used very similar code and it is spinning.
Difference that I assigned radians as float and you are missing assignment for view to display your layer.
- (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]; }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.