Now that a user can take a photo or select from their phone's photo library, we need to grab that image and display it. In order to do so, we need to implement the image picker's delegate method, the didFinishPickingMediaWithInfo
method. Below our action sheet delegate method, add the following code:
#pragma mark - UIImagePicker Delegate -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *pic; //Grab the stored image if ([info objectForKey:UIImagePickerControllerEditedImage]) { pic = [info objectForKey:UIImagePickerControllerEditedImage]; [self.finalImageView setImage:pic]; [self.placeholderImageView setHidden:YES]; } [self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; }
In this method, we create an instance of UIImage
and assign it using the info dictionary provided by...