Navigation Bar Disappears After Switching Views

Discussion in 'iOS Programming' started by Wellington2k, Jan 13, 2012.

  1. Wellington2k macrumors regular

    Joined:
    Jun 4, 2011
    #1
    Hello.

    So, I have a tableview application with a UIView squished on the top.
    On that UIView I have a Navigation Bar. When I tap on one of the cells it switches views to bring me to a description. But when I tap back, my Navigation Bar is gone. Any help?

    Screen Shot 2012-01-13 at 8.50.48 AM.png Screen Shot 2012-01-13 at 8.51.49 AM.png
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    1) Show us the code. We are just guessing right now

    2) Why are you not using the standard UINavigationController?
     
  3. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #3
    It's something I do.

    I just don't use the standard.

    I don't really know what code to put down.

    All of it is just a standard NSMutableArray:
    Code:
    cellarray = [[ NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4", nil];
    with a standard code to put it in the cells:
    Code:
    cell.textLabel.text = [cellarray objectAtIndex:indexPath.section];
    That's it.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    Then you are likely to have to solve your own problems as 99.99% of the rest of the programming world will not be doing what you are doing.

    I fail to see how any of the code is relevant. Or helpful. Or even understandable as single statements without knowing what methods they are in are pointless.

    How is the view structure setup? How does the navigation work in the absence of the standard and well understood navigation controller? Which objects are responsible for maintaining references to the views?
     
  6. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #6
    I found out that this problem has nothing to do with the Navigation Bar.

    It's the UIView that is at the top.

    What's selected in the photo.
    Screen Shot 2012-01-13 at 10.18.21 AM.png
     
  7. phantax macrumors member

    Joined:
    Feb 2, 2009
    #7
    What are you trying to accomplish that cannot be done with the standard UINavigationController?

    Seems like you are going out of your way to reproduce functionality that already exists.
     
  8. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #8
    I understand now.

    But I can't seem to find a good tutorial for it.
     
  9. jonnymo5 macrumors 6502

    Joined:
    Jan 21, 2008
    Location:
    Texas
    #9
    1. Create a navigation controller
    2. Push views onto it to dig deeper into your data
    3. Pop views off of it to come back

    Use the standards. They are there because they work. The Apple documentation has a bunch of examples that do this as does every iOS course on iTunes U.
     
  10. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #10
    Where have you looked? Because if you can't find a good tutorial on Navigation Controllers, I don't think you're trying that hard.
     
  11. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
  12. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #12
    Do you have a Storyboard-based project? Even if not, I have never found the need to even look at MainWindow.xib.
     
  13. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
  14. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #14
  15. Wellington2k, Jan 13, 2012
    Last edited: Jan 13, 2012

    Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
  16. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #16
    Wirelessly posted (Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3)

    Great! Would you be willing to share your final solution with the community?
     
  17. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
  18. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #18
    Well, sorry to be blunt, but that answer is as vague as your earlier responses and I'm still not entirely sure what the problem was.
     
  19. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #19
    Here is the FULL solution.

    I was not using a Navigation View Controller.

    I was using a regular View Controller with a UIView on the top.

    You have to use a Navigation View Controller.
     

Share This Page