Search code examples
iphoneobjective-cipaduitabbarcontroller

setting a tab bar controller view controller programmatically


Is there a way to set the view controller on the tab bar controller programmatically? Lets say I want it to show the second's tab view controller programmatically, is there a way to do that?

This is useful if I logout from my app, which is done from my third tab, when the user logins it should start from the 1st tab again. When I logout I am just showing a present modal view controller on top of what the previous view is, so I somehow needs to reset it again to the first tab bar without re-initializing it all over again.

The issue is now how do I do this?


Solution

  • Have a look at the reference on UITabBarController. Work with selectedIndex and selectedViewController.