1

I'm very new to iOS but have been put on a complex app. All the tutorials I have seen on storyboards, segues, views, etc. are very simple.

I have been able to use a segue to show a view and go back, but management doesn't care about segues. After moving through a complex app the user is supposed to be able to just jump way over to another part of the app, as if the user had gone back twice then selected another view, and then selected another view.

I'm just lost as to how to make this happen. Add a new direct segue in the storyboard editor? Or something to do with a custom segue created programatically? I need some hints on direction, like what methods to look at, what to google or a advanced tutorial and such. Thanks in advance.

Gerry
  • 1,031
  • 1
  • 14
  • 30
  • [Use perforfSegue method](http://stackoverflow.com/questions/9176215/understanding-performseguewithidentifier) – Neil Galiaskarov May 10 '14 at 19:20
  • Difficult to comment without full details of your GUI, and it would depend upon where the user can/cannot go next. But generalizing there's no reason why a segue can't jump from one section to another but you might have to be careful. Something you can do which may be applicable is swap the stack of view controllers that a navigation view controller has for another stack - that might apply to your situation where you say " jump way over to another part", but without a diagram I couldn't say and I doubt you're going to get any useful answers. – Gruntcakes May 10 '14 at 19:23
  • One thing to be mindful of, is that you shouldn't go back to previous controllers with any segue other than an unwind. – rdelmar May 10 '14 at 19:43
  • Well, it is something like view A -> B -> C -> D. Once the user is at D they need to be able to transparently go back to A, then down another path A -> X -> Y. We (or management) wants the user to be able to jump from D to Y. I don't need an exact answer, just some idea of the general strategy so I can do the right reading. – Gerry May 12 '14 at 15:36

1 Answers1

3

Usually, the Navigation Controller allows single 'pop's of view controllers in the stack. This works great for master-detail apps and linear workflows.

When one view controller is connected to another in a web-like fashion, things get difficult to manage.

If you want to rely on the automatted management of a view controller stack but go back more than one item at once, have a look at unwind segues: What are Unwind segues for and how do you use them? -- the answer is illustrated really well.

If you can navigate in circles, it gets more intricate. Essentially, your navigation controller would put new objects of already intantiated classes onto the stack to maintain its breadcrumb trail all the way back to the root view controller.

In some cases, this is not desirable. You could use a UINavigationControllerDelegate which removes items from the stack when certain conditions are met.

Let's say you have 4 view controllers, A--D. The possible connections are: A - B - C - {B,D} - A. From D, when you're finished, you want to unwind to A. From C, you may want to add an additional item at B, but you don't want to keep track of all the B-C-B-C-B-C-... connections. In these cases, altering the navigation controller history is useful and won't break the expected behavior of the "back" button.

Community
  • 1
  • 1
ctietze
  • 2,805
  • 25
  • 46
  • Thanks that's really helpful, I had not come across unwind segues, or at least didn't notice. – Gerry May 12 '14 at 15:35