Returning to first view

Discussion in 'iPhone/iPad Programming' started by Cpagal, Jul 26, 2010.

  1. macrumors newbie

    Joined:
    May 22, 2010
    #1
    I have made a four view application. Everything works pretty well. I have four viewcontrollers and have imported each viewcontroller at each view. To move from the the firstView to the secondView etc i use this code:

    Code:
    - (IBAction)pushButton:(id)sender {
    [self presentModalViewController:secondView animated:YES];}
    
    When I reach the fourthView I have a button and want to return to the firstView. I want to kind of loop the app if you know what i mean. The code I use to go to the first is the same:

    Code:
    - (IBAction)pushButton:(id)sender{
    	[self presentModalViewController:firstView animated:YES];}
    
    When the button is pressed it goes to the firstView but then when you press the button that goes to the secondView the app quits! What kind of code should i use?
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Maybe you should debug why your app is quitting first.
     
  3. thread starter macrumors newbie

    Joined:
    May 22, 2010
    #3
    How am I going to debug this? I think it's a problem of hierarchy of the views and I am actually a beginner in this!
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    Same as you would debug any other issue you might have in your code, I would think. Apply basic debugging methods. If you're not sure where to start, perhaps stop by here: Debugging Applications
    Good a time as any to learn then, huh? :)

    And since we're on the topic of beginners, a reminder: Posting code, please use the
    Code:
     tags[/URL]
     
  5. thread starter macrumors newbie

    Joined:
    May 22, 2010
    #5
    You actually don't help me at all! I tried to debug it looks like theres a memory leak. But I really don't know what to do! Can't you tell how I should have my views in order to move back and forth and change them and mix them, you know what I mean?
     
  6. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    No, I don't. Please elaborate.
     

Share This Page