UINavigationController回到了多个步骤

taf*_*rel 2 cocoa-touch uinavigationcontroller ios

是否可以在UINavigationController中弹出多个viewcontroller?假设我想退两步.

Oma*_*ith 13

是的,你可以做类似的事情

//Your navigation controller
UINavigationController *nav;

//Get the view controller that is 2 step behind
UIViewController *controller = [nav.viewControllers objectAtIndex:nav.viewControllers.count - 2];

//Go to that controller
[nav popToViewController:controller animated:YES];
Run Code Online (Sandbox Code Playgroud)