捕获 UITaBbarViewController 项目选择以决定显示它

Catch UITaBbarViewController item selection to make decision of showing it

我需要捕捉 UITabBarController 项目选择,以应对用户点击相机项目和应用程序请求权限的情况,如果未授予权限则不显示相机 VC。可能吗?

实施

func tabBarController(_ tabBarController: UITabBarController, 
              shouldSelect viewController: UIViewController) -> Bool {
   if viewController is YourVC {

   }
   else {}

}

并符合UITabBarControllerDelegate