ios 使用特定的popToViewController返回到相应的Controller

1、取navigationCtroller中的Controllers
NSArray * ctrlArray = self.navigationController.viewControllers;
2、取出后,执行,
[self.navigationController popToViewController:[ctrlArray objectAtIndex:0] animated:YES];
既可。(这里的objectAtIndex,根据情况而定)

备注:
NSArray *ctrlArray = self.navigationController.viewControllers;

for (UIViewController *ctrl in ctrlArray) {
    
    NSLog(@"ctrl ---- %@", ctrl);
    
}

 

你可能感兴趣的:(controller)