Created
October 19, 2013 04:33
-
-
Save nielswh/7051682 to your computer and use it in GitHub Desktop.
Get Image from Library
This file contains hidden or 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
| UIImagePickerController * picker = [[UIImagePickerController alloc] init]; | |
| [picker setDelegate:self]; | |
| [picker setAllowsEditing:YES]; | |
| [picker setSourceType: UIImagePickerControllerSourceTypeSavedPhotosAlbum]; | |
| [picker setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; | |
| [self presentViewController:picker animated:YES completion:^{ NSLog(@"We got something back from picking an Image");}]; | |
| - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info | |
| { | |
| [picker dismissViewControllerAnimated:YES completion:nil]; | |
| BOOL isCropped = NO; | |
| NSString *key = @"UIImagePickerControllerOriginalImage"; | |
| NSString *croppedKey = @"UIImagePickerControllerCropRect"; | |
| if ([[info allKeys] containsObject:croppedKey]) | |
| isCropped = YES; | |
| UIImage *img = [info objectForKey:key]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment