Created
October 28, 2014 15:36
-
-
Save palawer/2ca1b6652ec49de1f1ff to your computer and use it in GitHub Desktop.
Pick image from photo library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set delegate on header file | |
// <UINavigationControllerDelegate, UIImagePickerControllerDelegate> | |
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo | |
{ | |
// set on a UIImageView | |
self.selectedImage.image = image; | |
[self dismissModalViewControllerAnimated:YES]; | |
} | |
- (IBAction)openPicker:(id)sender | |
{ | |
UIImagePickerController *pickerController = [[UIImagePickerController alloc] init]; | |
pickerController.delegate = self; | |
[self presentViewController:pickerController animated:YES completion:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment