Pop 2 view controllers in Nav Controller in Swift

后端 未结 8 1001
星月不相逢
星月不相逢 2021-01-30 12:46

I have found many ways to pop back 2 UIViewControllers in UINavigationController using Objective-C, however when I try and switch that over to Swift it

8条回答
  •  情歌与酒
    2021-01-30 13:43

     let allViewControllers : [UIViewController] = self.navigationController!.viewControllers as [UIViewController]
            self.navigationController?.popToViewController(allViewControllers[allViewControllers.count-3], animated: true)
    

提交回复
热议问题