TabBarItem仅显示警报

我有一个应用程序,其中有3个选项卡(“主页”,“设置”,“注销”)。 选择第三个选项卡(注销)时,只应在先前选择的选项卡(即,“主页/设置”控制器顶部)上显示警报。

请帮助我以正确的方式进行操作。

现在,我正在尝试在选项卡didDidViewViewController委托中显示警报。它显示警报,但是用黑屏隐藏了Home / Settings Tab控制器。请检查我的代码。

func tabBarController(_ tabBarController: UITabBarController,didSelect viewController: UIViewController) {
        if tabBarController.selectedIndex == 2{
            let alert = UIAlertController(title: "Logout",message: "Do you want to logout?",preferredStyle: .alert)
            let okaction = UIAlertaction(title: "OK",style: .destructive) { (_) in
                self.logoutapiCall(param: params)
            }
            let cancelaction = UIAlertaction(title: "Cancel",style: .cancel,handler: nil)
            alert.addaction(okaction)
            alert.addaction(cancelaction)

            self.present(alert,animated: true,completion: nil)
leon4180 回答:TabBarItem仅显示警报

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3105111.html

大家都在问