klop/KLParallaxView

Memory leaking from shadow animation

Closed this issue · 0 comments

klop commented

The current CAAnimationGroup approach is using kCAFillModeForwards alongside removedOnCompletion = NO. The result is that animations are repeatedly added to the layer without deallocating on completion. A clean fix would be to modify the - createShadow - removeShadow methods to add the animation group themselves and set the model layer's properties to the arguments passed to - groupAnimationWithShadowOffset:, rather than returning an animation group, allowing us to revert to default behaviour (removedOnCompletion == YES && fillMode == kCAFillModeRemoved).