Fix excessive CPU usage with iOS demo

When going back to the demo list from Demo 7 (animation), the animations would continue running in an infinite loop in the background eating up CPU. Prevent the animation from looping if the view controller is no longer in the navigation stack.