How do I set selected tab in UITabBarController using StoryBoard?

前端 未结 10 1505
一整个雨季
一整个雨季 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:02

    You can also set the default tab in "User Defined Runtime Attributes" using storyboard.

    Select your Tab Bar Controller from storyboard, in the right pane select Identity Inspector and add an attribute:

    Key Path : selectedIndex
    Type     : Number
    Value    : 2 ( whatever number you want )
    

提交回复
热议问题