Return to Video

Picking Images - UIKit Fundamentals

  • 0:00 - 0:02
    When you have a complex project,
  • 0:02 - 0:06
    it's important to approach it
    one small piece at a time.
  • 0:06 - 0:09
    We don't recommend that you jump
    straight into writing meme.
  • 0:09 - 0:12
    It's easier to experiment
    if you create a temporary
  • 0:12 - 0:14
    X code project that you
    don't plan on keeping.
  • 0:14 - 0:17
    To learn to pick images, for
    example, you might want to create
  • 0:17 - 0:21
    a one button app that picks and
    displays a single image,
  • 0:21 - 0:24
    the smallest possible project that will
    let you learn what you need to know.
  • 0:24 - 0:27
    Baby steps to the meme generator.
  • 0:27 - 0:29
    So here I've made a simple
    project to experiment with, and
  • 0:29 - 0:32
    since the meme editor has a toolbar
    at the bottom of the screen,
  • 0:32 - 0:35
    I'm going to go ahead and
    drag one of those in.
  • 0:38 - 0:42
    And I'll position it and
    set its constraints.
  • 0:47 - 0:50
    The tool bar comes with this button,
    but I'm going to go head and
  • 0:50 - 0:52
    change its label to pick.
  • 0:56 - 1:00
    And you see I've already got an image
    view, so you can go head and
  • 1:00 - 1:03
    drag one of those in and
    set its constraints.
  • 1:03 - 1:06
    Now I'm going to close this
    outline view for a minute and
  • 1:06 - 1:11
    open up the assistant editor, and then
    we can add an outlet for our image view.
  • 1:22 - 1:27
    Now, let's go down to our button, and
    we'll add an action for our button.
  • 1:29 - 1:32
    Let's call it pickAnImage.
  • 1:35 - 1:38
    And that ought to do it for Storyboard.
  • 1:38 - 1:40
    So, we'll focus on our
    view controller file.
  • 1:40 - 1:43
    I'm going to get rid of this
    extra method for now, and
  • 1:43 - 1:48
    here in the pick and image method
    that we just added, we want to launch
  • 1:48 - 1:52
    out UI image picker controller,
    just like we did in lesson two.
  • 1:52 - 1:56
    So we add these two lines to present
    the image picker and let's run it and
  • 1:56 - 1:57
    see how it looks.
  • 2:01 - 2:02
    And there we go.
  • 2:02 - 2:03
    We can choose from our outlets.
  • 2:05 - 2:06
    So we're making progress, but
  • 2:06 - 2:11
    when I choose a picture, I can't
    really tell that it's being chosen.
  • 2:11 - 2:14
    We still need to implement
    the delegate pattern, and
  • 2:14 - 2:17
    set our view controller as
    the delegate of the image picker.
  • 2:17 - 2:20
    Next step, we'll investigate
    the delegate protocol so
  • 2:20 - 2:23
    we'll know what method will be called
    when the picker has an image chosen.
Title:
Picking Images - UIKit Fundamentals
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
UD788 - UIKit Fundamentals
Duration:
02:24
Udacity Robot edited English subtitles for 06-05 Picking Images
Udacity Robot edited English subtitles for 06-05 Picking Images
Cogi-Admin edited English subtitles for 06-05 Picking Images

English subtitles

Revisions Compare revisions