English subtitles

← 02-05 How does a view get presented modally?

02-05 How does a view get presented modally?

Get Embed Code
1 Language

Showing Revision 2 created 04/08/2015 by Udacity Robot.

  1. Imagine that you have the code for
    the messenger app.
  2. Where would we look to find a swift
    statement that presents the image picker
  3. view on top of the composer view?
  4. We would find such a statement in
    the view controller that's currently on
  5. screen, the compose
    message view controller.
  6. The indication looks like this.
  7. Now, let's have a closer look
    at these three arguments.
  8. The third one is often set to nil.
  9. It's a closure,
  10. which is a block of code that can be
    invoked once the view is presented.
  11. Jason will talk a lot more about
    closures in the next swift session.
  12. This second argument indicates
    how the view appears.
  13. When animated is set false, the view
    flashes onto the screen immediately,
  14. without the upward slide.
  15. For this first argument,
  16. we'll need a reference to the view
    controller that's being presented.
  17. Let's figure out how
    to get that reference.