Setting default tab in UITabBar in swift

前端 未结 4 791
傲寒
傲寒 2020-12-28 22:57

I\'m almost finished with a project and am working out the last few UI kinks. My app uses a tab bar to navigate and for aesthetic purposes I want the app to open on the last

4条回答
  •  情歌与酒
    2020-12-28 23:27

    There is a nice way to do this straight from interface builder on your tab bar controller click the identity inspector, and set a User Defined Runtime Attribute.

    In this case each index of the tab bar control is indexed like a 0 based array. So the far left is 0, next to the right is 1, then 2 etc...

    So in my case I wanted 'tasks' to be selected first, so you set the selectedIndex to type Number and value '1'. Refer to my attached image.

提交回复
热议问题