tags:

views:

15

answers:

1

I'm developing a iphone app based UITabBarController,when open the app,on the first tab item, I press a button,to add a label to the view,and I close the app.

Next open,the label which added last time still on the first tab item,I did not save the view in applicationWillTerminate method,why?

And,if I switch to the second tab item,and return the first tab item,the view of first stay as before,is the UIView instance keep alive during the app running time,or what reason?

Thanks.

A: 

This is the default behaviour of the tab bar controller. If you want to change it, you have to override the UITabBarControllerDelegate. And also from iPhone OS 4.0 when you close the application pressing the home button, the app is not really closed. It goes background. If you want your tab bar controller to work as you mention, go to the initial view. You have to override some App Delegate methods, like

- (void)applicationWillResignActive:(UIApplication *)application

or

- (void)applicationDidEnterBackground:(UIApplication *)application
karim
Thanks for your reply.I think I understand it.
bl0ck