如何解雇一个标签栏控制器,并返回到前一个视图控制器按钮
我建立就像一个流动的点击这个如何解雇一个标签栏控制器,并返回到前一个视图控制器按钮
FirstViewController - > SecondViewController - >标签栏视图控制器(包括1 ThirdViewController和2 。FourthVIewController)
我打开标签栏视图控制器作为一个弹出形式SecondViewController。然而,当我运行(self.dismiss(动画:真,完成:无))在ThirdViewController点击按钮,它可以追溯到FirstViewController。 我想回去SecondViewController
添加代码。 这是我从我的SecondViewController
let popupVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "tabBarVC") as! UITabBarController
self.addChildViewController(popupVC)
popupVC.view.frame = self.view.frame
self.view.addSubview(popupVC.view)
popupVC.didMove(toParentViewController: self)
打开标签栏视图控制器这是我尝试关闭标签栏视图控制器形式的三视图控制器
self.dismiss(animated: true, completion: nil))
您在secondViewController一个加入tabBarController子视图。所以你需要从超级视图中删除tabBarController视图。
对于这一点,你需要一个tabBarController对象。
self.tabBarController?.view.removeFromSuperview()
的问题仍然存在。在做上述操作时,我被重定向到FirstViewController。我想回到我已编辑根据您提供的代码的答案SecondViewController – BKSingh
,请检查 –
您可以使用导航控制器的流量,所以当你在ThirdViewController使用:
if let vc = self.storyboard?.instantiateViewController(withIdentifier: "second") as? SecondViewController {
self.navigationController?.popToViewController(vc, animated: true)
}
这是没有做任何事情。视图留在那里 – BKSingh
下面的代码能够去除TabView的,带我回SecondViewController
self.tabBarController?.view.removeFromSuperview()
向我们展示你的代码 – janusbalatbat