Pulsing animation removed after bringing app back to the foreground
ddewaele opened this issue · 6 comments
When the demo app is running and the home button is pressed, the app is pushed to the background.
When the app is launched again. the pulsing animation is gone.
What would be the correct hook to bring the animation back on the screen ?
For us we see it going away even when you present a view controller over a view controller that has a pulsing halo. Would love an explanation on this!
@unmute I have a simple app where a new viewcontroller is pushed onto the stack via a navigation controller, and the pulsing halo (placed on the first viewcontroller) was also shown on the second viewcontroller. I thought this was normal behaviour.
I had to remove it by executing the following code :
[self.halo removeAllAnimations];
[self.halo removeFromSuperlayer];
In the latest version there was an addition starting on line 105 in PulsionHaloLayer.m of the CAAnimationGroup delegate method. This method seems to be called when pushing a view controller or presenting one which in turn removes the animation. I added the if (flag) then remove the animations as that signals the animation is truly done. I am unsure if this is correct but for now until I revisit the code it will have to do. Below is my code for that method which would not remove the animation when a view controller is pushed or presented.
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
if (flag)
{
[self removeAllAnimations];
[self removeFromSuperlayer];
}
}
@unmute thanks a lot for your suggestion. I experienced the exact same issue as you and your suggestion about has helped me fix it.
Does not work for me
I created updated version named "Pulsator" which is written in Swift.
https://github.com/shu223/Pulsator
This problem has been fixed at the repo. Usage is almost same.