PDA

View Full Version : Returning to first view




Cpagal
Jul 26, 2010, 02:59 PM
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:


- (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:


- (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?



dejo
Jul 26, 2010, 03:01 PM
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?
Maybe you should debug why your app is quitting first.

Cpagal
Jul 26, 2010, 05:22 PM
Maybe you should debug why your app is quitting first.

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!

dejo
Jul 26, 2010, 05:54 PM
How am I going to debug this?
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 (http://developer.apple.com/iphone/library/documentation/xcode/conceptual/iphone_development/130-Debugging_Applications/debugging_applications.html)
...and I am actually a beginner in this!
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 (http://forums.macrumors.com/showthread.php?t=747660)

Cpagal
Jul 27, 2010, 04:08 PM
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?

dejo
Jul 27, 2010, 04:11 PM
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?
No, I don't. Please elaborate.