user1145581 user1145581 - 4 months ago 7x
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


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!