Bad Boy
Bad Boy

Reputation: 628

how to write code for the log out in my off line iphone app

hi friends i am using UIButton for "LOGOUT" in a tabBarController having Five tabs like(Tab1,Tab2...) in IB OUTLET i have logout page in "Tab5", when i clicks logout i am removing page from super view and Showing "login PageView Controller",but when i log in again it going to Same log out page...but i need to do two things like

1)Initialize Tabbar again and 2)i want to show Tabbar from first tab, like Tab1 can help anyone... Thx in Advance

Upvotes: 0

Views: 2004

Answers (1)

nekno
nekno

Reputation: 19267

I think the question is, how do you write code to "log out" your app and clear all of the data in all of the views across a tab bar controller?

If I can help translate, I think the scenario is essentially this:

He has an app with two view controllers in MainWindow.xib, a UIViewController and a UITabBarController. Both are hooked up to IBOutlet properties on his app delegate. When the app loads, the app delegate instantiates both controllers automatically, and he shows the UIViewController with a login form.

When the user logs in, it uses some technique to hide the UIViewController and show the UITabBarController.

On a view in one of the tabs in the UITabBarController, there is a logout button. When the button is tapped, it removes the UITabBarController from the superview and shows the login UIViewController.

When the user logs in again, the UITabBarController has remained in memory, so the state has not changed since logging out. All of the data on all of the tab views needs to be reset.

What's the best practice to scrap the UITabBarController and reinstantiate it?

You can't use the following, since MainWindow.xib contains your app delegate, and another UIViewController, not just your UITabBarController:

tabBarController = [[UITabBarController alloc] initWithNibName:"MainWindow" bundle:nil];

Upvotes: 1

Related Questions