我有带 5 个 TabBarItem 的 TabBarViewController
当我站在 TabBarItem[0] 时,我通过导航推送到 ViewController。 从那个 ViewController,我切换到 TabBarItem[4]。 问题是:当我站在 TabBarItem[4] 时,如何在 TabBarItem[0] 中 PopToRootViewController?
非常感谢。
(我的主要问题是当我从 TabBarItem[4] 切换到 TabBarItem[0] 时收到警告:
【Transition】Unbalanced calls to begin/end appearance transitions for ABCViewController
所以当我站在 TabBarItem[4] 时,我想 PopToRootViewController 在 TabBarItem[0]。 如果我能做到,上面的警告就不会再出现了)
最佳答案
在选项卡 4 的 viewDidAppear
中
if let first = self.tabBarController.viewControllers.first as? UINavigationController {
// popToRoot here
first.popToRootViewController(animated:false)
}
关于swift - PopToRootViewController 在一个标签栏项目中来自另一个标签栏项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50128150/