woot586
woot586

Reputation: 3965

iPhone - How to save each view controller?

When my app's “applicationWillTerminate” function is called in the app’s delegate file I need to loop through each child controller of a tab controller and save the current state it is in. Is it possible to loop through each viewController calling a custom save function?

Upvotes: 1

Views: 220

Answers (2)

hypercrypt
hypercrypt

Reputation: 15376

Have a look at UIApplicationWillTerminateNotification and UIApplicationDidEnterBackgroundNotification. Much nicer than looping through your view controllers.

Upvotes: 1

Jakob W
Jakob W

Reputation: 3377

Get the tabBarController.viewControllers and send the makeObjectsPerformSelector:@selector(yourCustomSaveMethod) message to that array.

Upvotes: 3

Related Questions