Return to Video

05-06 Adding Start Over button: Step 2

  • 0:00 - 0:02
    Now let's implement
    the start over method.
  • 0:02 - 0:04
    How should we implement this method?
  • 0:04 - 0:09
    Which class should be responsible for
    navigating back to the root of the app?
  • 0:09 - 0:13
    In this case, the answer is the UI
    navigation controller class.
  • 0:13 - 0:16
    Each view controller has
    a navigation controller property.
  • 0:16 - 0:19
    It's an optional that references
    the navigation controller that
  • 0:19 - 0:22
    a given view controller is embedded in.
  • 0:22 - 0:25
    When a view controller receives
    the invocation to start over,
  • 0:25 - 0:27
    it can communicate with
    the navigationController.
  • 0:27 - 0:31
    And here you can see the careful
    unwrapping of the optional.
  • 0:31 - 0:35
    We could just pop off the current
    viewController like this, but
  • 0:35 - 0:37
    we want to go all the way
    back to the beginning.
  • 0:37 - 0:40
    So we call popToRootViewController.
  • 0:40 - 0:43
    Here's a recap of the two
    properties we just learned about.
  • 0:43 - 0:47
    The navigation item property
    specifies features of the nav bar.
  • 0:47 - 0:50
    The navigation controller property
    provides a reference back to
  • 0:50 - 0:52
    the navigation controller for
  • 0:52 - 0:55
    programmatic control of
    view controller popping.
  • 0:55 - 0:57
    Now take some time to get to
    know these properties and
  • 0:57 - 1:00
    get that start over button working for
    all the end points in your story.
Title:
05-06 Adding Start Over button: Step 2
Description:

05-06 Adding Start Over button: Step 2

more » « less
Video Language:
English
Team:
Udacity
Project:
UD788 - UIKit Fundamentals
Duration:
01:02

English subtitles

Revisions Compare revisions