Skip to content

Instantly share code, notes, and snippets.

@danmartyn
Created June 15, 2013 08:20
Show Gist options
  • Save danmartyn/5787380 to your computer and use it in GitHub Desktop.
Save danmartyn/5787380 to your computer and use it in GitHub Desktop.
Image Library
UIImagePickerController *libraryController = [[UIImagePickerController alloc] init];
libraryController.delegate = self;
libraryController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
libraryController.allowsEditing = YES;
// if on the ipad, show the library in a popover
if (iPad)
{
UIPopoverController *libraryPopover = [[UIPopoverController alloc] initWithContentViewController:libraryController];
[libraryPopover presentPopoverFromRect:self.rectToPresentPopoverFrom inView:self.scrollView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
self.popover = libraryPopover;
} else
{
[self presentViewController:libraryController animated:YES completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment