1

I've had a look around and can't find any reference to default tab of a Tab Bar Controller in xCode. I would like the middle tab to be selected as the default when the app loads. Is there a way to do this?

I've noticed that people are sating to do:

tabBarController.selectedIndex = 2;

Where do I put this? My UITabBarController doesn't have a class file associated with it as I used storyboard to lay it out.

Alex
  • 3,031
  • 6
  • 34
  • 56
  • im not sure with storyboards (i have not used them extensively), but you can for sure extend UITabBarController set the default tab you want and inside IB point the TabBarController from the default to your custom class – Bill Bonar Feb 16 '12 at 15:47

1 Answers1

7

There is not a default tab option you could extend the TabBarController and create a method that would set it on init

or simply when defined you can choose the correct tab

[tabBarController setSelectedIndex: 2]

Bill Bonar
  • 1,017
  • 2
  • 10
  • 22