开发者

iPhone - How to save each view controller?

开发者 https://www.devze.com 2023-04-10 00:44 出处:网络
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.开发者_如

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.开发者_如何学Go Is it possible to loop through each viewController calling a custom save function?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号