Return to Video

02-05 How does a view get presented modally?

  • 0:00 - 0:03
    Imagine that you have the code for
    the messenger app.
  • 0:03 - 0:06
    Where would we look to find a swift
    statement that presents the image picker
  • 0:06 - 0:08
    view on top of the composer view?
  • 0:08 - 0:11
    We would find such a statement in
    the view controller that's currently on
  • 0:11 - 0:14
    screen, the compose
    message view controller.
  • 0:14 - 0:16
    The indication looks like this.
  • 0:16 - 0:18
    Now, let's have a closer look
    at these three arguments.
  • 0:18 - 0:20
    The third one is often set to nil.
  • 0:20 - 0:21
    It's a closure,
  • 0:21 - 0:25
    which is a block of code that can be
    invoked once the view is presented.
  • 0:25 - 0:29
    Jason will talk a lot more about
    closures in the next swift session.
  • 0:29 - 0:32
    This second argument indicates
    how the view appears.
  • 0:32 - 0:36
    When animated is set false, the view
    flashes onto the screen immediately,
  • 0:36 - 0:38
    without the upward slide.
  • 0:38 - 0:40
    For this first argument,
  • 0:40 - 0:43
    we'll need a reference to the view
    controller that's being presented.
  • 0:43 - 0:45
    Let's figure out how
    to get that reference.
Title:
02-05 How does a view get presented modally?
Description:

02-05 How does a view get presented modally?

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

English subtitles

Revisions Compare revisions