Key Concepts: Segues

Segues are a simple and powerful construct for transitioning to another viewController with animations. The animations are built in and don’t require additional code. Push segues require that your viewController is inside a UINavigationController.

ViewControllers have methods that you can override to ensure things get done at certain times. viewDidLoad is one such case where we are overriding a method from the superclass, UIViewController.

prepareForSegue is another method that will be called on your viewController just before a segue is performed. It is your opportunity to pass data to the next viewController based on the user’s action.

VGetting back or unwinding from a segue requires you to define an IBAction (manually) in your destinationViewController. Then you can create a segue from a control to the green exit icon in the sourceViewController. Your IBAction sender type needs to be of type UIStoryboardSegue* for the Interface Builder to see it when control-dragging to the exit button.

Properties can be used to pass data between viewControllers. Properties are a special type of method and are most easily identified using what is commonly referred to as "dot notation".

Storyboards will often contain many viewControllers. The yellow icons at the top of the lower right hand Interface Builder (Storyboard editor) represent subclasses of UIViewControllers that can be added to the Storyboard. For now we will only be using direct subclasses of UIViewController itself.

Back to Top