(iOS 5.0)
I have an CAKeyframeAnimation added to a view's layer with an infinite repeat count (a cursor blinking). However, when switching apps and coming back, the animation gets removed from the layer (or possibly the entire layer is replaced, I'm not sure).
I tried re-adding them on viewDidLoad and viewWillAppear, but neither is called when switching apps. I did find there is a applicationWillEnterForeground: method in UIApplicationDelegate. I'm planning to use this but I have two questions:
- Are there any other circumstances that trigger the animations or layer to be unloaded? Is there a more appropriate event to listen to?
- What is the best practice (in an design pattern sense) to respond to these events (e.g. using target action)?