作为一个新手,请告诉我如何在照片库中选择多个图像。一周以来我一直在寻找解决方案,但没有找到与我的代码相关的解决方案。根据我的代码,我可以一次选择一个图像。这是我的代码现在的样子:
-(IBAction) photosClick
{
ipc= [[UIImagePickerController alloc] init];
ipc.delegate= self;
ipc.sourceType= UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController: ipc animated:YES];
}
-(void) imagepickerControllerDidCancel: (UIImagePickerController *)picker
{
[[picker parentViewController] dismissViewControllerAnimated:YES completion: nil];
[picker release];
}
-(void) imagePickerController: (UIImagePickerController *)picker didFinishPickingMediaWithInfo: (NSDictionary *)info
{
UIImage *image;
NSURL *mediaURL;
mediaURL= (NSURL *)[info valueForKey: UIImagePickerControllerReferenceURL];
NSString *imagePath= [[NSString alloc] init];
imagePath= [mediaURL absoluteString];
NSLog(@"path of the image is: %@", imagePath);
image= (UIImage *) [info valueForKey: UIImagePickerControllerOriginalImage];
imageView.image= image;
[picker dismissModalViewControllerAnimated:YES];
[picker release];
}
-(void) imagePickerControllerDidCancel: (UIImagePickerController *)picker
{
[picker dismissModalViewControllerAnimated:YES];
}
请通过编辑我的代码来帮助我解决这个问题,以便我能很好地理解。我一直坚持这一点,没有得到任何解决方案。