How to trigger method “tabBarController:didSelectViewController:” programmatically?

后端 未结 2 763
攒了一身酷
攒了一身酷 2021-01-13 00:00

Currently, I am trying to trigger the \'didSelectViewController\' method programmatically via the following code:

self.tabController.selectedViewController 
         


        
2条回答
  •  无人共我
    2021-01-13 00:28

    For swift 3.0 you can programmatically call tabbar delegate method like this

    self.tabController.selectedIndex = index (e.g. 0,1...etc)
    self.tabController.delegate.tabBarController(self.tabController, didSelectViewController: self.tabController.viewControllers[index])
    

提交回复
热议问题