gpt4 book ai didi

ios - 在 IOS 的 ImageView 中显示多个图像

转载 作者:行者123 更新时间:2023-11-29 11:43:16 24 4
gpt4 key购买 nike

我在我的项目中使用 ELCImagePickerController。通过它从图库中选择多个图像。我面临一个问题,如何在 View Controller 的 ImageView 中显示选定的多个图像。我创建了一个选择图像按钮,它将我们带到我们选择多张图像的照片库。我的代码是,

- (IBAction)Select:(id)sender {
ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initImagePicker];
elcPicker.maximumImagesCount = 100; //Set the maximum number of images to select to 100
elcPicker.returnsOriginalImage = YES; //Only return the fullScreenImage, not the fullResolutionImage
elcPicker.returnsImage = YES; //Return UIimage if YES. If NO, only return asset location information
elcPicker.onOrder = YES; //For multiple image selection, display and return order of selected images
// elcPicker.mediaTypes = @[(NSString *)kUTTypeImage, (NSString

*)kUTTypeMovie]; //Supports image and movie types

elcPicker.imagePickerDelegate = self;

[self presentViewController:elcPicker animated:YES completion:nil];

}


- (void)elcImagePickerController:(ELCImagePickerController *)picker

didFinishPickingMediaWithInfo:(NSArray *)info
{
[self dismissViewControllerAnimated:YES completion:nil];

for (NSDictionary *dict in info)
{
if ([dict objectForKey:UIImagePickerControllerMediaType] ==
ALAssetTypePhoto)
{
if ([dict objectForKey:UIImagePickerControllerOriginalImage])

{
UIImage* image=[dict
objectForKey:UIImagePickerControllerOriginalImage];

_arrimage.image;
}
}
}

}

- (void)elcImagePickerControllerDidCancel:(ELCImagePickerController *)picker
{

[self dismissViewControllerAnimated:YES completion:nil];
}

最佳答案

您可以使用 CreolePhotoSelection获取并选择多个图像。它将帮助您获得多项选择并将所有选定的值检索到委托(delegate)方法中。

下面是它的示例代码:

CreolePhotoSelection *objCreolePhotoSelection= [[CreolePhotoSelection alloc] initWithNibName:@"CreolePhotoSelection" bundle:nil];
objCreolePhotoSelection.strTitle = YOUR_TITLE_FOR_PHOTO_VIEW;
objCreolePhotoSelection.delegate = self; // It will help to retrive all selected photos from CreolePhotoSelection
objCreolePhotoSelection.arySelectedPhoto = YOUR_CURRENT_ARRAY; // You need to pass same array which is holding selected image
objCreolePhotoSelection.maxCount = YOUR_MAX_PHOTOS_LIMIT; // Eg. 5, 10 anythings...

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:objCreolePhotoSelection];
[self.navigationController presentViewController:navController animated:YES completion:nil];

// Delegate Method
#pragma mark - Photo selected Delegate Method
-(void)getSelectedPhoto:(NSMutableArray *)aryPhoto
{
// You will selected image array into aryPhoto object and you can use it
}

关于ios - 在 IOS 的 ImageView 中显示多个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45273309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com