I have an animation in viewDidLoad that runs the first time the app is launched. if you exit the app, then launch it again the animation doesn’t play.
how would I go about making the animation play each and every time the app is opened,
thanks for any help
In iOS 4, pressing the home button doesn’t terminate the app, it suspends it. When the app is made active again, a
UIApplicationDidBecomeActiveNotificationis posted. Register for that notification and initiate the animation in your handler.Edit: Added code below.
Here’s one way to do it: Have your view controller become an observer of
UIApplicationDidBecomeActiveNotificationin itsviewWillAppear:method.Unregister for the notification in your view controller’s
viewDidDisappear:method.Finally, put your animation code in the selector specified when registering to receive the notification.