Before I pull my hair out!

Discussion in 'iPhone/iPad Programming' started by Abunga, Apr 26, 2011.

  1. macrumors newbie

    Abunga

    Joined:
    Jan 25, 2011
    #1
    Please help!

    I have been trying all day to simply move to another view once a button is pressed. I don't want a navigation or tool bar on my app.

    I am completely lost as how to sort this. Every example and written text shows navigation stacks and such, but none of them have worked when implementing it to my test app.

    In simple: I have a single view that has a button on it. This button is linked to an action. When this action is started, it runs a 'pushViewController' script.

    Code:
    RedView *redView2 = [[RedView alloc] initWithNibName:@"RedView" bundle:nil];
    	
    [self.navigationController pushViewController:redView2 animated:YES];
    [redView2 release];
    
    Nothing happens.

    Although this seems simple to some and ridiculous to others, it is one of two or three different methods i have tried.

    Is it that this is the the wrong way to go about it when not using navigation/tool bars?

    Where can i find the help i need. I find the Apple documentation never answers the questions i ask. After a day trying to sort this SIMPLE task, it is wearing me thin. :mad:
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Yes, that's the wrong way. Since self.navigationController will be nil.

    Have you looked at the View Controller Programming Guide for iOS? Also, you might want to create a project based on the Utility Application template; that shows how to have a new view displayed in reaction to a button push.
     
  3. thread starter macrumors newbie

    Abunga

    Joined:
    Jan 25, 2011
    #3
    Thanks.

    Thanks Dejo, thought it might be wrong.

    Will look this up. Strangely, i was just reading about Utility Apps.

    :rolleyes:
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I'd use a navigation based app and just hide the navigation bar (it's easy: look in the documentation). That way you can push and pop view controllers without any problems.
     
  5. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    Im with Duncan on this one..
    Just create a navigationController, use the easy functionality, but just hide the topbar.
    And u can push/pop controllers with code instead of using the buttons on the top.
    That should set you on the right way
     
  6. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    Gaaaah. Why do people keep choosing to call me Duncan? That's my surname. Either use the full username or the first part.
     
  7. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #7

    Gaaaah. I saw your post about this in another post, but it was after i posted (u post?! i mean understand.)
    I'm sorry *bow down*. On iphonedevsdk was a guy called Duncan too, so I got used to it, sorry Robbie Or RobbieDuncan x)
     
  8. thread starter macrumors newbie

    Abunga

    Joined:
    Jan 25, 2011
    #8
    Much appreciated for the help, i didn't think about hiding the bar. :eek:
     

Share This Page