For login situations, where all kinds of things must reset themselves when logging out or next logging in, I like to create a notification like "NewUserReset". All that is necessary for reset for the initial state listens for a notification and launches a method that performs any type of reset that it needs. On the tab, the name of the button to exit the system has changed, the temporary data structures are nil / zero / release, etc.
It perfectly separates the output from all the things that need to be done so that you do not try to manipulate the view controllers and data storage and display on the screen from the controller that got the system out.
Sending a notification is easy. When the user removes the Exit button, you will send a notification similar to this:
[[NSNotificationCenter defaultCenter] postNotificationName:@"JMUserLogout" object:nil];
You do not need to call it JMUserLogout, you just need a line that you recognize, and something - I used your initials - to ensure that you do not accidentally send a notification with the same name as a notification that you do not know about, listening.
When this notification disappears, any object that registered with the center by default to listen to @JMUserLogout will perform any action you choose. Here's how your object is registered (this should be located in some place, such as ViewWillLoad or the object initialization method):
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resetForNewUser:) name:@"JMUserLogout" object:nil];
The selector there, resetForNewUser :, is simply the name of the method that you want to run when the notification is disabled. This method is as follows:
- (void)resetForNewUser:(NSNotification *)notif { // DO SOMETHING HERE }
Where he says // DO HERE, you will add code specific to your application. For example, you can add a tab bar as a JMUserLogout notification observer. In your method resetForNewUser: you must change the name of the logout button to log in.
In the ViewController or View or data store, which stores old data from the previous user, the resetForNewUser method will delete all this data and return things as they should be in front of the new user. For example, if a previous user entered data in a UITextField, you would delete the text, yourTextFieldName.text = @ "";
Finally, it is important that you also remove your object as an observer before it is released. In your Dealloc method, for each object registered to receive a notification, you add the following:
[[NSNotificationCenter defaultCenter] removeObserver:self];
Hope this makes sense. The Apple documentation for NSNotificationCenter explains more, and they provide some sample applications that use notifications.