Implementing UIImagePickerControllerDelegate methods
The UIImagePickerControllerDelegate
protocol has a set of methods that you must implement in your delegate object to interact with the image picker controller interface.
To learn more about the UIImagePickerControllerDelegate
protocol, see https://developer.apple.com/documentation/uikit/uiimagepickercontrollerdelegate.
When the image picker controller appears on screen, the user has the option of selecting a photo or canceling. If the user cancels, the imagePickerControllerDidCancel(_:)
method is triggered, and if the user selects a photo, the imagePickerController(_:didFinishPickingMediaWithInfo:)
method is triggered.
You’ll implement these methods in your AddJournalEntryViewController
class now. In the Project navigator, click the AddJournalEntryViewController
file. Type the following code in the AddJournalEntryViewController
class after the CLLocationManagerDelegate
methods:
// MARK: - UIImagePickerControllerDelegate...