How to avoid Modal Storyboard infinite loop

Posted by misthills on Stack Overflow See other posts from Stack Overflow or by misthills
Published on 2012-11-06T05:32:06Z Indexed on 2012/11/10 5:00 UTC
Read the original article Hit count: 192

Filed under:
|
|
|
|

I've written a number of iOS applications a year ago on an old version of Xcode. I've just started a new project and discovered the storyboard feature in the latest Xcode. It turns out this is perfect for the application I am writing as it consists of ~30 interlinked screens.

My question is, how do I structure my storyboard and segues to allow my application to follow a circular path through my screens. I have seen a number of examples that simply segue screen 1 to screen 2 and then screen 2 to screen 1 using the modal option. This clearly works but when I debug an application built this way, it instantiates a new instance of each screen (view controller) for every segue performed. In the diagram below (apologies, I drew a nice picture but due to my newbie status, was not able to post it), how do I go from screen 1 to screen 2 to screen 3 and back to original screen 1 without creating a new instance?

// Screen 1 --> Screen 2 --> Screen3 
//     ^                         | 
//     |                         | 
//     +-------------------------+ 

© Stack Overflow or respective owner

Related posts about xcode

Related posts about ios5