How to pop from one view controller to another view controller

前端 未结 8 1326
北荒
北荒 2021-01-31 09:53

Using iOS I Have 15 ViewControllers now I want to pop from one ViewController to another View Controller.

I am using this code:

SecondViewController *Sec         


        
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-31 10:28

    Swift 4.0 - Swift 5.0

     for controller in self.navigationController!.viewControllers as Array {
                if controller.isKind(of: HomeViewController.self) {
                    self.navigationController!.popToViewController(controller, animated: true)
                    break
                }
            }
    

提交回复
热议问题