Pop 2 view controllers in Nav Controller in Swift

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

    You can dynamically pop multiple viewcontrollers in (swift 2.0)

    let allViewController: [UIViewController] = self.navigationController!.viewControllers as [UIViewController];
    
                            for aviewcontroller : UIViewController in allViewController
                            {
                                if aviewcontroller .isKindOfClass(YourDestinationViewControllerName)
                                {
                                 self.navigationController?.popToViewController(aviewcontroller, animated: true)
                                }
                            }
    

提交回复
热议问题