S. Birklin
S. Birklin

Reputation: 1385

iOS Swift Segues

What I want: When I'm on my green screen and push the button "PushToBrown" I want the brown screen "think" that I'm coming from blue. So if push the back Button in my brown screen I always want to go back to blue.

At the moment: I call from my green screen programmatically for example performSegueWithIdentifier(..., nil) and can switch to brown or just implement it by drag&drop (from the button "PushToBrown" to the brownVC screen). But if push the "back Button" I go back to Green. -> How can I tell brown he should always go back to blue?

Segue Example

I suppose that's a problem with the navigation Controller. You could also help me if you know some really good tutorials for segues or navigationcontroller handlding.

Thanks in advance!

Upvotes: 0

Views: 106

Answers (1)

Miknash
Miknash

Reputation: 7948

The solution for your problem would be unwind segue : What are Unwind segues for and how do you use them?

What you should do ( as you can see in the link ) is add exit point, create unwind method and call that one instead of simple popViewcontroller. The first answer contains both explanation, code examples, and both Objective-C and swift

Upvotes: 3

Related Questions