问题
i implemented a navigation controller which has 10+ view.. here by swiping right in view am switching 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,
回答1:
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.
回答2:
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.
回答3:
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....
来源:https://stackoverflow.com/questions/4601343/iphone-ipad-navigationcontroller-poptoviewcontroller-not-functioning