Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

launch photo gallery from iphone App

Is it possible to launch (redirect the user to) the native photo gallery application of iphone from my app, similar to emails? Is this now possible in 4.2 sdk?

like image 315
irpalo Avatar asked Nov 30 '25 17:11

irpalo


1 Answers

For this, you have to create and present a UIImagePickerController like this:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
[self presentModalViewController:imagePicker animated:YES];

You can change imagePicker.sourceType to imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; if you want the user to use the camera instead.

The delegate method: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info will give you the image in the info dictionary.

like image 166
Chintan Patel Avatar answered Dec 02 '25 06:12

Chintan Patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!