0

I have a UITabBarController based iphone application. I added a new tab called Log Out via the Interface Builder.

However I don't need its corresponding view. I want the Log Out tab to redirect to the Login view as soon as it is clicked (of course some session clearing code is executed as well).

The nearest I've got so far is to redirect from the Log Out View using the viewWillAppear. The result is the same but it doesnt look great because it goes into a blank screen for a couple of seconds and then it redirect to the login screen.

Any help would be appreciated.

manospro
  • 799
  • 1
  • 6
  • 16
  • Simple question: is a tab the correct solution for this kind of feature? It seems awkward to me. Why not having a navigation bar with a logout navigation item instead? – Valentin Jacquemin Feb 16 '11 at 12:29

1 Answers1

0

You can use UITabbarDelegate methods to accomplish this

Use following delegate method to check for logout buttons index and if found then perform your tasks

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{

       if (tabBarController.selectedIndex == 4)
       {
         // perform logout tasks
       }


}
Saurabh
  • 22,743
  • 12
  • 84
  • 133