As I promised in Chapter 5, I’m going to talk about the image picker view controller. This view controller manages Apple-supplied interfaces for choosing images and movies, and on supported devices it takes new images or movies with the camera. As this class handles all of the required interaction with the user, it is very simple to use. All you need to do is tell it to start, and then dismiss it after the user selects an image or movie.
In this section, we’ll continue to build on our City Guide
application. Either of the two versions of the application we now have
will do, as all of the changes we’re going to make will be confined to
AddCityController class. In the
preceding section, we made only relatively minor changes in this class
that won’t affect our additions here.
However, if you want to follow along, I’m going to return to our original version and work on that. As we did in the preceding section, you should work on a copy of the project, so right-click or Ctrl-click on the folder containing the project files and select Duplicate. A folder called CityGuide copy will be created containing a duplicate of our project. You should probably rename the folder to something more sensible. I suggest CityGuide3, and renaming the project by selecting Project→Rename from the Xcode menu bar.
The first thing we need to do is build an interface to allow the user to trigger the image picker. If you remember ...