S.MacPherson S.MacPherson - 2 months ago 10x
Objective-C Question

Performing segue (unwind?) in an UIAlertController

I have all this in my Main.storyboard.

NavigationController > ViewOneController > ViewTwoController

At end of my game in ViewController2, I would like to return to the ViewController1 by using a segue in my UIAlertAction.

I understand that I leave the code in UIAlertAction handler. Then:

// some segue function

How do I link this back to ViewController1 where I can start a new game?

I don't know which segue to type in the ViewController1.m, is this an unwindSegue and how would I link them?



You're not being really clear, but I'm guessing you want to unwind back to the initial ViewController. Try this:


Objective-C code

Swift 3

Swift 3 code