So now that I have a Navigation/Table View embedded in a Tab View....

Discussion in 'iOS Programming' started by inspirations365, May 27, 2010.

  1. inspirations365 macrumors regular

    Joined:
    Dec 28, 2008
    #1
    Okay, so I've finally gotten my tab bar controller to work in conjunction with a navigation controller and table view controller so that I can select a tab, then select a choice from a list and go back to the choices from an individual choice in the table.

    Now I need help going a couple of steps further.

    This section is going to be as follows in the end:
    Tab -> table choice -> table choice -> picture. At each table choice stage, I need to be able to return to the previous table (a la navigation). How would I accomplish these nested navigation/table...things in addition to the picture at the end?

    Like would the hierarchy in IB go:
    Tab Bar controller
    ->Nav Controller (I know up to here is correct)
    ->Nav Controller
    ->???
    ->Picture

    Or would it follow some other system?

    Thanks! I've started over a couple of times already (thanks, IB for not helping out!), and I can feel how close I am this time.
     
  2. TiberiusXavier macrumors member

    Joined:
    Apr 18, 2010
    Location:
    Chicago
    #2
    Try:
    Code:
    [self.navigationController popViewControllerAnimated: YES];
    // Or to go directly to top.
    [self.navigationController popToRootViewControllerAnimated: YES];
    
     
  3. inspirations365 thread starter macrumors regular

    Joined:
    Dec 28, 2008
    #3
    So where does that code go? In the Navigation Controller or the Table View Controller?

    Thank you for the assistance.
     
  4. TiberiusXavier macrumors member

    Joined:
    Apr 18, 2010
    Location:
    Chicago
  5. inspirations365 thread starter macrumors regular

    Joined:
    Dec 28, 2008
    #5
    Which one? There is one for every nav controller. Here's perhaps a better explanation of what I'm trying to do:

    I select a Tab. The view switches to a table of choices. (Up to here works).

    Picking one, 1) I get another table of choices. At the top of the screen is a navigation bar to the previous table.

    Picking another one, 2) the view switches to a picture that I can manipulate. At the top of the screen is a navigation bar to the previous table.

    So in IB I have a Tab Bar Controller as the root, a nested navigation controller that works with the table, and gets me to the first table. Should I then have another nested navigation controller to get me to 2)? How exactly do I do that?
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    You just need one navController within each tab. Then push your views (table view, detail view) onto it's navigation stack. Just remember to set the navController's root view controller to your top level table view controller.
     

Share This Page