Book Image

Application Development in iOS 7

By : Kyle Begeman
Book Image

Application Development in iOS 7

By: Kyle Begeman

Overview of this book

Table of Contents (15 chapters)
Application Development in iOS 7
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting the image from UIImagePickerController


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...