user1145581 user1145581 - 1 year ago 65
iOS Question

Setting the default tab when using storyboards

Can anyone please tell me how to set the default tab when using storyboards in iOS. I can't seem to figure out how to accomplish this.

Thank you

Answer Source

You can use one of these two methods:

tabBar.items = tabBarItems;
tabBar.selectedItem = [tabBarItems objectAtIndex:0];

or a direct method from the object

[tabBar setSelectedItem:myUITabBarItem];

or you can combine them to do this:

tabBar.items = tabBarItems;
[tabBar setSelectedItem:[tabBarItems objectAtIndex:0]];

but i havent tested that method yet, hope this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download