假设NavigationController有ABC三个ViewController,A push B,B push C 要求C返回的时候直接返回A,即移除B(popToRoot不予考虑,A之前可能还有其他的)
解决方案:修改viewControllers数组
NSMutableArray* navArray = [[NSMutableArray alloc] initWithArray:self.navigationController.viewControllers];
[navArray replaceObjectAtIndex:[navArray count]-1 withObject:nextViewController]; [self.navigationController setViewControllers:navArray animated:YES];