UINavigationController and Pushing Views

Discussion in 'iOS Programming' started by zachsilvey, Dec 15, 2010.

  1. zachsilvey macrumors 6502

    Joined:
    Feb 5, 2008
    Location:
    Battle Ground
    #1
    I have been able to successfully create a navigation controller and pass it a root view controller. My problem is when I try to push a new view from inside the root view I am having issues.

    say I have a UINavigationController called nav that I initialize, add a root view and add to the window in the app delegate. Then I have an IBAction in the root view class that is supposed to push another view on to the stack I initialize the second view then use

    Code:
    [self.nav pushViewController:secondLevel animated:YES];
    
    because this is how the Navigation-Based template works.

    I know I am doing something wrong OOP wise. Do I need to set up a delegate for the UINavigationController or something?
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    So, you're saying in your RootViewController, you're calling the above line of code? First, are you sure the method it contains is getting called? Second, what is self.nav when you get to this point?
     
  3. zachsilvey thread starter macrumors 6502

    Joined:
    Feb 5, 2008
    Location:
    Battle Ground
    #3
    Thanks for the input but I figured it out. I don't exactly know what I did but everything is working nicely now. I think I forgot to save Interface Builder before building.
     

Share This Page