iOS pop到指定页面

oc:

for (UIViewController *temp in self.navigationController.viewControllers) {

if ([temp isKindOfClass:[你要跳转到的Controller class]]) {

[self.navigationController popToViewController:temp animated:YES];

}

}

swif:```
let vcIndex = self.navigationController?.viewControllers.indexOf({ (viewController) -> Bool in

        if let _ = viewController as? Personal {
            return true
        }
        return false
    })
    
    let composeVC = self.navigationController?.viewControllers[vcIndex!] as! Personal
    
    self.navigationController?.popToViewController(composeVC, animated: true)

你可能感兴趣的:(iOS pop到指定页面)