Another very useful feature of storyboards is unwinding. Unwinding is a process similar to that of a segue, but instead of presenting the next view controller, it reverses to a previous view controller in a storyboard. The great thing about it is that it allows us to go back to any view controller, not just the one that is right before the current controller we are in. This recipe will show how to use unwinding.
For this recipe, we will need the project StoryboardApp
we created in the previous recipe. Open it in Xamarin Studio.
Perform the following steps to implement unwinding:
Add a new class to the project and name it
ModalController
.Make the class a custom view controller, similar to
FirstController
andSecondController
in the project, as follows:[Register("ModalController")] public class ModalController : UIViewController { public ModalController (IntPtr handle) : base(handle) { } }
Add the following method in the
FirstController
...