从照片库中获取照片

时间:2010-09-09 01:17:01

标签: iphone

我使用下面的代码从照片库中获取照片但是使用此代码我可以获得保存照片中存在的照片而不是照片库中存在的所有照片

-(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

2 个答案:

答案 0 :(得分:1)

使用此

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

适合我

答案 1 :(得分:0)

这可让您使用相机拍照或从库中选择。它为您处理整个过程。

https://github.com/fulldecent/FDTake