-6

I want to jump to third tab in tabcontroller. I searched in Google but found nothing helpful.

If anybody can help I will be grateful.

Abizern
  • 146,289
  • 39
  • 203
  • 257
rockford333
  • 1
  • 1
  • 1
  • 4
    You "searched from google nothing helpful"? What did you search for? I searched for `jump to tab uitabbarcontroller` and the first hit has your answer. – rob mayoff Jan 22 '12 at 18:29
  • sorry - i just have to agree with Rob on this one. it's simply impossible to believe that you've searched for anything on google prior to asking this question. – Rok Jarc Jan 22 '12 at 18:50
  • Hi, I have searched in google. I got some examples I tried in my solution but nothing works for me. – rockford333 Jan 23 '12 at 03:35
  • I searched in Google and got here. How's that for a circular reference? – Jochem Feb 21 '13 at 12:48

2 Answers2

6

Was the title/question changed? I thought the question was about Xcode...

For what you're asking, try setting selectedIndex of your UITabBarController, like this:

self.tabBarController.selectedIndex = indexOfTab;

However don't overuse it, some automatic transitions between tabs can be considered as bad user experience.

Don't just stop with this shortcut - learn more! Here's an extensive list of Xcode 4 shortcuts: print the B&W version, pin it your wall, learn and enjoy the Xcode even more.

matm
  • 7,059
  • 5
  • 36
  • 50
  • Yes, the question was radically edited. And those who answered the asked question are apparently being down voted. – user371320 Jan 22 '12 at 18:54
  • It wasn't radically edited. You can see the edits, I only corrected it to make it clearer that he was asking about a tabbar controller. He mentions the controller in the question and in the tags. Some people get the IDE confused with the language. I just removed the references to Xcode. – Abizern Jan 22 '12 at 22:04
  • Hi, Thanks for replay. I have tried but failed. I have three tabs starts from left first one map, second vehicle number, third one Login.By default applications opened maps tab. `i want to go login tab. Can you please tell me how can I do this. – rockford333 Jan 23 '12 at 03:31
4

You want to set the selectedIndex property of the tab controller

http://developer.apple.com/library/ios/documentation/uikit/reference/UITabBarController_Class/Reference/Reference.html

Robot Woods
  • 5,677
  • 2
  • 21
  • 30