Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 18, 2009, 12:38 AM   #1
rareflares
macrumors regular
 
Join Date: Jun 2004
Location: Washington D.C.
Dismissing Modal Views

How exactly do I dismiss a modal view controller at the bottom of the stack (to get back to the main screen) if I am currently in the topmost view of the stack?

Thanks for your help.
__________________
8-Core 2.8Ghz Intel Xeon, Mac OSX 10.5.6, 2 GB RAM, 320GB HD, SuperDrive, 256 MB ATI Radeon 2600. I'm either on that or a 16GB iPhone 4.
rareflares is offline   0 Reply With Quote
Old Feb 18, 2009, 01:04 AM   #2
rareflares
Thread Starter
macrumors regular
 
Join Date: Jun 2004
Location: Washington D.C.
well, i figured out one way to do it, but if anyone has a better solution let me know:

My modal view stack goes 3 deep, so to get to the first one i just did:

[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];





EDIT: well unfortunately if I try to go back into my Modal views, the views don't load. not sure what to do now...
__________________
8-Core 2.8Ghz Intel Xeon, Mac OSX 10.5.6, 2 GB RAM, 320GB HD, SuperDrive, 256 MB ATI Radeon 2600. I'm either on that or a 16GB iPhone 4.
rareflares is offline   0 Reply With Quote
Old Feb 18, 2009, 01:58 AM   #3
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
From the Developer Documentation for dismissModalViewControllerAnimated:
Quote:
If you dismiss a modal view controller in the middle or bottom of the stack, all the modal view controllers on top of that view controller are also dismissed. Use the modalViewController property before invoking this method if you need to retain the modal view controller.
dejo is online now   0 Reply With Quote
Old Feb 19, 2009, 02:15 AM   #4
rareflares
Thread Starter
macrumors regular
 
Join Date: Jun 2004
Location: Washington D.C.
alright i was on the right track before but now I think I figured it out

basically you just have to dismiss every single modal view starting with the bottom-most and then once all the modal view have been dismissed, you have to present the bottom one again. That will take you from the topmost modal view back to the first one.
__________________
8-Core 2.8Ghz Intel Xeon, Mac OSX 10.5.6, 2 GB RAM, 320GB HD, SuperDrive, 256 MB ATI Radeon 2600. I'm either on that or a 16GB iPhone 4.
rareflares is offline   0 Reply With Quote
Old Dec 7, 2009, 11:07 AM   #5
smcbride15
macrumors newbie
 
Join Date: Dec 2009
Any chance you could put up the code for how you did this? Thanks
smcbride15 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Dismissing auto-correct? mavis iOS 7 2 Jul 5, 2013 05:23 PM
bouncy Keyboard - keeps dismissing self. IDMah iPhone/iPad Programming 0 Jan 9, 2013 03:04 PM
Hiding/dismissing keyboard. ubelai iOS 5 and earlier 2 Jun 5, 2012 08:55 AM

Forum Jump

All times are GMT -5. The time now is 07:08 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC