Skip to content

Instantly share code, notes, and snippets.

@robc
Created January 19, 2010 23:15
Show Gist options
  • Save robc/281413 to your computer and use it in GitHub Desktop.
Save robc/281413 to your computer and use it in GitHub Desktop.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
if ([self deviceHasCamera] && indexPath.row == 0)
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
else
imagePickerController.sourceType = (UIImagePickerControllerSourceTypePhotoLibrary || UIImagePickerControllerSourceTypeSavedPhotosAlbum);
NSLog(@"sourceType: %i", imagePickerController.sourceType);
[self presentModalViewController:imagePickerController animated:YES];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment