在项目中有时候需要我们pop到指定页面:
+ (void)popToController:(NSString *)controllerName {//pop到指定页面
Class controllerClass = NSClassFromString(controllerName);
for (UIViewController *controller in self.navigationController.viewControllers) {
if ([controller isKindOfClass:controllerClass]) {
UIViewController *toController =(UIViewController *)controller;
[self.navigationController popToViewController:toController animated:YES];
}
}
}