Skip to content

Instantly share code, notes, and snippets.

@nielswh
Created October 19, 2013 04:33
Show Gist options
  • Select an option

  • Save nielswh/7051682 to your computer and use it in GitHub Desktop.

Select an option

Save nielswh/7051682 to your computer and use it in GitHub Desktop.
Get Image from Library
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