首页 > 解决方案 > Swift 4 pop to a view controller : navigation method

问题描述

Pop To viewController : Go to Previos controller

self.navigationController?.popToViewController(AddSalesController, animated: true)

标签: iosswiftxcodeswift4

解决方案


Make sure your controller is in the navigation stack and you can try this code.

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

推荐阅读