how to get the event that switch tab menu on iphone

后端 未结 5 2302
星月不相逢
星月不相逢 2020-12-03 17:03

I\'m trying to figure out how to catch the event that controls the switch tabs on the UITabBarController. How could I accomplish this?

5条回答
  •  有刺的猬
    2020-12-03 17:22

    Better late than never. In case of swift 4 you can do it in the following way.

    tabBarViewController.delegate = self
    

    And implement UITabBarDelegate in your class. You will get the callback in

    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
      //Stuff to do
    }
    

提交回复
热议问题