Programmatically switching between tabs within Swift

后端 未结 8 544
伪装坚强ぢ
伪装坚强ぢ 2020-11-30 02:32

I need write some code to switch the view to another tab when the iOS app starts (so, for example, the second tab is shown by default rather than the first).

I\'m ne

8条回答
  •  温柔的废话
    2020-11-30 03:11

    The viewController has to be a child of UITabBarControllerDelegate. So you just need to add the following code on SWIFT 3

    self.tabBarController?.selectedIndex = 1
    

提交回复
热议问题