开发者

Choosing definite ViewController from opened View stacks

开发者 https://www.devze.com 2022-12-10 16:07 出处:网络
I have 5 UIs/Views and these are if in normal way,one after another..1->2->3->4->5..But when i reach page 5, I would like to reopen page 3 back.I know i can use PushViewController but this one is as c

I have 5 UIs/Views and these are if in normal way,one after another..1->2->3->4->5..But when i reach page 5, I would like to reopen page 3 back.I know i can use PushViewController but this one is as creating one more view and I don't want to do like that.As my views are already in view stack i m wondering anything like i can choose the definite view from just now opened stacks.开发者_JAVA百科For PopViewController i can open very recent page (for my case it will be page 4).But i would like to jump over to page 3.How can I do that?Any suggestions please.


There are basically three ways you can go back in the UINavigationController's stack:

  1. One controller at a time, using popViewControllerAnimated:.
  2. All the way back to the bottom of the stack, using popToRootViewControllerAnimated:.
  3. Back to a specific controller in the stack, using popToViewController:animated:.

That last should do what you're trying to do. The one down side is that you need to pass that method a pointer to controller you want to back track to. So you'll need to figure out some way to make that happen (pass a pointer down through the stack, walk back the chain of parentViewController values, keep a pointer at your application delegate, etc.).

0

精彩评论

暂无评论...
验证码 换一张
取 消