开发者

iphone, ipad Navigationcontroller popToViewController not functioning

i implemented a navigation controller which has 10+ view.. here by swiping right in view am switc开发者_Go百科hing to the next view... swiping left will bring u the previous page. here i used poptoviewcontroller for go to prevous page.

in each of every page it has a menu to switch over to desired view. after jumping to the particular view if we swiping left will brings previously visited view instead of this i just want to go the previous page as per the menu...

here i used all the property of poptoviewcontroller but it doest work any suggestion.

thnks,


You have to think of the Navigation's view controllers as a stack (like a stack of papers on you desk).

So, if push something on to the stack, when you pop something off the stack, it'll be the previous item.

I'm not sure what you're doing, but I would look at the documentation for UINavigationController's setViewController:Animated method. I think it'll help with your problem.


Let me explain you what is nvaigationcontroller stack.

Stack = {root, A, B, C, D}.

The current visible view is D. When you make pushViewController(E) is means that you added a new view to the stack, which becomes visible: Stack = {root, A, B, C, D, E}. When you make popViewController you deleted the last element of the stack and set the new last element to be visible, in our case it becomes : Stack = {root, A, B, C, D} again and D is visible. Now if you choose popToRootController(A) it means you remove all the elements from the stack untill the top element is A and it becomes visible so in our case it's Stack = {root, A}.

I hope I understood correctly your question and explained you so that you could understand correctly the hierarchy. If not, please reformulate your question.


finally i solved this issue. but not using setViewController method infact.

here while pushig the view itself i added the views in stack. ie for example i want go to the view A to D means i added b and c with pushviewcontroller animated:NO; and D with animated:YES;

So it worked perfectly for me....

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜