我在我的应用程序中使用了 ELCImagePicker 我遇到了两个问题,第一个问题是画廊出现的视图不等于 iPhone 或 iPad 的宽度,比如图像爆炸,第二个问题是画廊中出现的图像像素化而不是正常分辨率。
//----------------------------------------------------
//imagePicker Zone
- (IBAction)uploadImageActionButton:(id)sender {
ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initImagePicker];
elcPicker.maximumImagesCount = 5; //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
{//yes
[self dismissViewControllerAnimated:YES completion:nil];
//
NSMutableArray *images = [NSMutableArray arrayWithCapacity:[info count]];
NSMutableArray *name = [NSMutableArray arrayWithCapacity:[info count]];
NSMutableArray *path = [NSMutableArray arrayWithCapacity:[info count]];
NSString *aDocumentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSInteger anIndex = 0;
for(NSDictionary *dict in info) {
UIImage *image = [dict objectForKey:UIImagePickerControllerOriginalImage];
[images addObject:image];
UIImageView *imageview = [[UIImageView alloc] initWithImage:image];
[imageview setContentMode:UIViewContentModeScaleAspectFit];
// Save Image
NSString *anImageName = [NSString stringWithFormat:@"%ld.jpg", 1+(long)anIndex++];
NSString *anImagePath = [NSString stringWithFormat:@"%@/%@", aDocumentsDirectory, anImageName];
NSData *anImageData = UIImageJPEGRepresentation(image, 0.5);
[anImageData writeToFile:anImagePath atomically:YES];
[path addObject:anImagePath];
[images addObject:anImageData];
}
_chosenImages=images;
_chosenImagesName=name;
_chosenImagesPath=path;
NSLog(@"name %@",_chosenImagesName);
}
- (void)elcImagePickerControllerDidCancel:(ELCImagePickerController *)picker
{//yes
[self dismissViewControllerAnimated:YES completion:nil];
}