-
Notifications
You must be signed in to change notification settings - Fork 466
Description
-
(void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info
{
[self dismissViewControllerAnimated:YES completion:nil];for (UIView *v in [_scrollView subviews]) {
[v removeFromSuperview];
}CGRect workingFrame = _scrollView.frame;
workingFrame.origin.x = 0;NSMutableArray *images = [NSMutableArray arrayWithCapacity:[info count]];
for (NSDictionary dict in info) {
if ([dict objectForKey:UIImagePickerControllerMediaType] == ALAssetTypePhoto){
if ([dict objectForKey:UIImagePickerControllerOriginalImage]){
UIImage image=[dict objectForKey:UIImagePickerControllerOriginalImage];
[images addObject:image];UIImageView *imageview = [[UIImageView alloc] initWithImage:image]; [imageview setContentMode:UIViewContentModeScaleAspectFit]; imageview.frame = workingFrame; [_scrollView addSubview:imageview]; workingFrame.origin.x = workingFrame.origin.x + workingFrame.size.width; } else { NSLog(@"UIImagePickerControllerReferenceURL = %@", dict); } } else if ([dict objectForKey:UIImagePickerControllerMediaType] == ALAssetTypeVideo){ if ([dict objectForKey:UIImagePickerControllerOriginalImage]){ UIImage* image=[dict objectForKey:UIImagePickerControllerOriginalImage]; [images addObject:image]; UIImageView *imageview = [[UIImageView alloc] initWithImage:image]; [imageview setContentMode:UIViewContentModeScaleAspectFit]; imageview.frame = workingFrame; [_scrollView addSubview:imageview]; workingFrame.origin.x = workingFrame.origin.x + workingFrame.size.width; } else { NSLog(@"UIImagePickerControllerReferenceURL = %@", dict); } } else { NSLog(@"Uknown asset type"); }}
self.chosenImages = images;
[_scrollView setPagingEnabled:YES];
[_scrollView setContentSize:CGSizeMake(workingFrame.origin.x, workingFrame.size.height)];
}