如何在 popToRootViewController 之后显示警报

How to show Alert after popToRootViewController

我如何在我的 rootviewcontroller 从另一个 Viewcontroller 层次结构更高的弹出到它后显示警报?

设置是这样的:

TabbarController <- NavigationController <- ViewController <- ViewController <- Viewcontroller

self.navigationController?.popToRootViewController(animated: true)

你可以试试

let root =  self.navigationController!.viewControllers[0]
self.navigationController?.popToRootViewController(animated: true)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.8) {
  let alert = ///
  root.present(alert....
}