UIImageView is disappearing after CAKeyframeAnimation

后端 未结 1 1201
南方客
南方客 2020-12-30 16:15

I\'m trying this code (found in an answer here on SO) in a category on UIView and am using it to peform a \"pop\" animation on a UIImageView nested inside of a UITableViewCe

相关标签:
1条回答
  • 2020-12-30 16:50

    Don't use those two lines. Instead actually set the transform on the layer. Replace these two lines:

    animation.fillMode = kCAFillModeForwards;
    animation.removedOnCompletion = NO;
    

    with the final transform state:

    [[self layer] setTransform:scale4];
    

    When setting fill mode forwards and not removing the animation, it is causing the final state to be visual only. You need to actually change the layer's internal state for the property you're animating. To do so, override the animation for the transform property by using the transform name when adding the animation to the layer. This will cause the animation to use your animation instead of the default.

    [[self layer] addAnimation:animation forKey:@"transform"];
    
    0 讨论(0)
提交回复
热议问题