Resolved Backing out of many view with 1 click?

Discussion in 'iOS Programming' started by larswik, Oct 4, 2012.

  1. larswik, Oct 4, 2012
    Last edited: Oct 4, 2012

    larswik macrumors 68000

    Joined:
    Sep 8, 2006
    #1
    I have an app where the user is clicking on a few buttons which push new views on the stack 5 or 6 deep. When he finally makes a selection he must back all the way out again via the back button.

    Is there a way in the final view have an extra button that would go back to the first view in the stack with just 1 click? Not pus the first view on again but remove all the others from the stack without having to back out 1 by 1?

    I tried Google'n but I don't know what this would be called?

    Thanks!
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Have you tried looking at the class reference for UINavigationController, especially the section on Pushing and Popping Stack Items?
     
  3. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #3
    I did not. But with in a minute of looking at the Methods for that Class I discovered this which looks promising popToRootViewControllerAnimated:
     
  4. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #4
    Easy Pezy, Thanks for pointing that out Dejo.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #5
    Documentation, especially Class References, is your friend. They're the first place I go when I'm curious about something.
     
  6. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #6
    Do us all a favor and do your own research before you run to the forums. It's understandable if sometimes you can't figure something out, but you admitted that you didn't even look at the documentation. That gets old fast, and you burn through a lot of goodwill when you do that.
     
  7. larswik thread starter macrumors 68000

    Joined:
    Sep 8, 2006
    #7
    I do... I always go to Class references first or Google for similar problems. For some reason I wasn't sure what to search this time. I looked at UIButton and UIViews first and people with similar issues but nothing came up with my search terms. I then knew I was looking for the wrong thing so I asked.

    As soon as dejo mentioned UINavigationController it became obvious right away and I found what I needed quickly.

    Class Refs and Google are great if I know what I am looking for. In this instance UINavigationController wasn't the area I was looking under.

    Thanks.
     

Share This Page