Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rareflares

macrumors regular
Original poster
Jun 7, 2004
180
0
Washington D.C.
How exactly do I dismiss a modal view controller at the bottom of the stack (to get back to the main screen) if I am currently in the topmost view of the stack?

Thanks for your help.
 

rareflares

macrumors regular
Original poster
Jun 7, 2004
180
0
Washington D.C.
well, i figured out one way to do it, but if anyone has a better solution let me know:

My modal view stack goes 3 deep, so to get to the first one i just did:

[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];





EDIT: well unfortunately if I try to go back into my Modal views, the views don't load. not sure what to do now...
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
From the Developer Documentation for dismissModalViewControllerAnimated:
If you dismiss a modal view controller in the middle or bottom of the stack, all the modal view controllers on top of that view controller are also dismissed. Use the modalViewController property before invoking this method if you need to retain the modal view controller.
 

rareflares

macrumors regular
Original poster
Jun 7, 2004
180
0
Washington D.C.
alright i was on the right track before but now I think I figured it out

basically you just have to dismiss every single modal view starting with the bottom-most and then once all the modal view have been dismissed, you have to present the bottom one again. That will take you from the topmost modal view back to the first one.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.