tags:

views:

53

answers:

1

I use below code for get photo from photo library but with this code i can get photo that exist in save photo not all photo that exist in photo library

-(void)addphoto
{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{
 [picker dismissModalViewControllerAnimated:YES];
 UIImage *takephoto = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
 [self srAdd:takephoto];
}//imagePuckerController
+1  A: 

use this

- (IBAction)getImageAction {
self.imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:self.imgPicker animated:YES];}

works for me

alecnash
Thank you and how to take photo from camera?
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; self.imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentModalViewController:self.imgPicker animated:YES];hope it helps
alecnash