Dismissing Modal Views

Discussion in 'iOS Programming' started by rareflares, Feb 17, 2009.

  1. macrumors regular

    Joined:
    Jun 7, 2004
    Location:
    Washington D.C.
    #1
    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.
     
  2. thread starter macrumors regular

    Joined:
    Jun 7, 2004
    Location:
    Washington D.C.
    #2
    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...
     
  3. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    From the Developer Documentation for dismissModalViewControllerAnimated:
     
  4. thread starter macrumors regular

    Joined:
    Jun 7, 2004
    Location:
    Washington D.C.
    #4
    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.
     
  5. macrumors newbie

    Joined:
    Dec 7, 2009
    #5
    Any chance you could put up the code for how you did this? Thanks
     

Share This Page