How do I set selected tab in UITabBarController using StoryBoard?

前端 未结 10 1537
一整个雨季
一整个雨季 2020-12-31 00:38

How can I switch to some tab in UITabBarController using StoryBoard? I have tried the code below but without success (the tab is not selected):

         


        
10条回答
  •  清歌不尽
    2020-12-31 01:10

    Grab your instance of UITabBarController then set the selectedViewController property:

    yourTabBarController.selectedViewController=[yourTabBarController.viewControllers objectAtIndex:3];//or whichever index you want
    

提交回复
热议问题