Pop 2 view controllers in Nav Controller in Swift

后端 未结 8 990
星月不相逢
星月不相逢 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:39

    user5320485 answer in swift3

    let viewControllers = self.navigationController!.viewControllers as [UIViewController];
    for aViewController:UIViewController in viewControllers {
        if aViewController.isKind(of: AdCreateViewController.self) {
            _ = self.navigationController?.popToViewController(aViewController, animated: true)
        }
    }
    

提交回复
热议问题