Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f87cfcd0d3
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (54 sloc) 2.39 kb
//
// ELCImagePickerController.m
// ELCImagePickerDemo
//
// Created by Collin Ruffenach on 9/9/10.
// Copyright 2010 ELC Technologies. All rights reserved.
//
#import "ELCImagePickerController.h"
#import "ELCAsset.h"
#import "ELCAssetCell.h"
#import "ELCAssetTablePicker.h"
#import "ELCAlbumPickerController.h"
@implementation ELCImagePickerController
@synthesize delegate;
-(void)cancelImagePicker {
if([delegate respondsToSelector:@selector(elcImagePickerControllerDidCancel:)]) {
[delegate performSelector:@selector(elcImagePickerControllerDidCancel:) withObject:self];
}
}
-(void)selectedAssets:(NSArray*)_assets {
NSMutableArray *returnArray = [[[NSMutableArray alloc] init] autorelease];
for(ALAsset *asset in _assets) {
NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];
[workingDictionary setObject:[asset valueForProperty:ALAssetPropertyType] forKey:@"UIImagePickerControllerMediaType"];
ALAssetRepresentation *assetRep = [asset defaultRepresentation];
CGImageRef imgRef = [assetRep fullScreenImage];
UIImage *img = [UIImage imageWithCGImage:imgRef
scale:assetRep.scale
orientation:(UIImageOrientation)assetRep.orientation];
[workingDictionary setObject:img forKey:@"UIImagePickerControllerOriginalImage"];
[workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:@"UIImagePickerControllerReferenceURL"];
[returnArray addObject:workingDictionary];
[workingDictionary release];
}
[self popToRootViewControllerAnimated:NO];
[[self parentViewController] dismissModalViewControllerAnimated:YES];
if([delegate respondsToSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:)]) {
[delegate performSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:) withObject:self withObject:[NSArray arrayWithArray:returnArray]];
}
}
#pragma mark -
#pragma mark Memory management
- (void)didReceiveMemoryWarning {
NSLog(@"ELC Image Picker received memory warning.");
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (void)dealloc {
NSLog(@"deallocing ELCImagePickerController");
[super dealloc];
}
@end
Jump to Line
Something went wrong with that request. Please try again.