Setting the default tab when using storyboards

前端 未结 12 926
执笔经年
执笔经年 2020-12-12 16:27

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

12条回答
  •  一生所求
    2020-12-12 16:52

    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!

提交回复
热议问题