diff --git a/src/ios/ELCImagePicker/ELCAlbumPickerController.h b/src/ios/ELCImagePicker/ELCAlbumPickerController.h deleted file mode 100644 index 151c0f7..0000000 --- a/src/ios/ELCImagePicker/ELCAlbumPickerController.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// AlbumPickerController.h -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import -#import -#import "ELCAssetSelectionDelegate.h" -#import "ELCAssetPickerFilterDelegate.h" - -@interface ELCAlbumPickerController : UITableViewController - -@property (nonatomic, weak) id parent; -@property (nonatomic, strong) NSMutableArray *assetGroups; -@property (nonatomic, assign) BOOL singleSelection; -@property (nonatomic, assign) BOOL immediateReturn; - -// optional, can be used to filter the assets displayed -@property (nonatomic, weak) id assetPickerFilterDelegate; - -@end - diff --git a/src/ios/ELCImagePicker/ELCAlbumPickerController.m b/src/ios/ELCImagePicker/ELCAlbumPickerController.m deleted file mode 100644 index 8317d97..0000000 --- a/src/ios/ELCImagePicker/ELCAlbumPickerController.m +++ /dev/null @@ -1,164 +0,0 @@ -// -// AlbumPickerController.m -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import "ELCAlbumPickerController.h" -#import "ELCImagePickerController.h" -#import "ELCAssetTablePicker.h" - -@interface ELCAlbumPickerController () - -@property (nonatomic, strong) ALAssetsLibrary *library; - -@end - -@implementation ELCAlbumPickerController - -//Using auto synthesizers - -#pragma mark - -#pragma mark View lifecycle - -- (void)viewDidLoad -{ - [super viewDidLoad]; - - [self.navigationItem setTitle:@"Loading..."]; - - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self.parent action:@selector(cancelImagePicker)]; - [self.navigationItem setRightBarButtonItem:cancelButton]; - - NSMutableArray *tempArray = [[NSMutableArray alloc] init]; - self.assetGroups = tempArray; - - ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init]; - self.library = assetLibrary; - - // Load Albums into assetGroups - dispatch_async(dispatch_get_main_queue(), ^ - { - @autoreleasepool { - - // Group enumerator Block - void (^assetGroupEnumerator)(ALAssetsGroup *, BOOL *) = ^(ALAssetsGroup *group, BOOL *stop) - { - if (group == nil) { - return; - } - - // added fix for camera albums order - NSString *sGroupPropertyName = (NSString *)[group valueForProperty:ALAssetsGroupPropertyName]; - NSUInteger nType = [[group valueForProperty:ALAssetsGroupPropertyType] intValue]; - - if ([[sGroupPropertyName lowercaseString] isEqualToString:@"camera roll"] && nType == ALAssetsGroupSavedPhotos) { - [self.assetGroups insertObject:group atIndex:0]; - } - else { - [self.assetGroups addObject:group]; - } - - // Reload albums - [self performSelectorOnMainThread:@selector(reloadTableView) withObject:nil waitUntilDone:YES]; - }; - - // Group Enumerator Failure Block - void (^assetGroupEnumberatorFailure)(NSError *) = ^(NSError *error) { - - UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[NSString stringWithFormat:@"Album Error: %@ - %@", [error localizedDescription], [error localizedRecoverySuggestion]] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; - [alert show]; - - NSLog(@"A problem occured %@", [error description]); - }; - - // Enumerate Albums - [self.library enumerateGroupsWithTypes:ALAssetsGroupAll - usingBlock:assetGroupEnumerator - failureBlock:assetGroupEnumberatorFailure]; - - } - }); -} - -- (void)reloadTableView -{ - [self.tableView reloadData]; - [self.navigationItem setTitle:@"Select an Album"]; -} - -- (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCount -{ - return [self.parent shouldSelectAsset:asset previousCount:previousCount]; -} - -- (void)selectedAssets:(NSArray*)assets -{ - [_parent selectedAssets:assets]; -} - -#pragma mark - -#pragma mark Table view data source - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - // Return the number of sections. - return 1; -} - - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - // Return the number of rows in the section. - return [self.assetGroups count]; -} - - -// Customize the appearance of table view cells. -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - static NSString *CellIdentifier = @"Cell"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; - } - - // Get count - ALAssetsGroup *g = (ALAssetsGroup*)[self.assetGroups objectAtIndex:indexPath.row]; - [g setAssetsFilter:[ALAssetsFilter allPhotos]]; - NSInteger gCount = [g numberOfAssets]; - - cell.textLabel.text = [NSString stringWithFormat:@"%@ (%ld)",[g valueForProperty:ALAssetsGroupPropertyName], (long)gCount]; - [cell.imageView setImage:[UIImage imageWithCGImage:[(ALAssetsGroup*)[self.assetGroups objectAtIndex:indexPath.row] posterImage]]]; - [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; - - return cell; -} - -#pragma mark - -#pragma mark Table view delegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - ELCAssetTablePicker *picker = [[ELCAssetTablePicker alloc] initWithNibName: nil bundle: nil]; - picker.parent = self; - - picker.assetGroup = [self.assetGroups objectAtIndex:indexPath.row]; - [picker.assetGroup setAssetsFilter:[ALAssetsFilter allPhotos]]; - - picker.assetPickerFilterDelegate = self.assetPickerFilterDelegate; - picker.immediateReturn = self.immediateReturn; - picker.singleSelection = self.singleSelection; - - [self.navigationController pushViewController:picker animated:YES]; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return 57; -} - -@end - diff --git a/src/ios/ELCImagePicker/ELCAsset.h b/src/ios/ELCImagePicker/ELCAsset.h deleted file mode 100644 index ebef368..0000000 --- a/src/ios/ELCImagePicker/ELCAsset.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// Asset.h -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import -#import - -@class ELCAsset; - -@protocol ELCAssetDelegate - -@optional -- (void)assetSelected:(ELCAsset *)asset; -- (BOOL)shouldSelectAsset:(ELCAsset *)asset; -@end - - -@interface ELCAsset : NSObject - -@property (nonatomic, strong) ALAsset *asset; -@property (nonatomic, weak) id parent; -@property (nonatomic, assign) BOOL selected; - -- (id)initWithAsset:(ALAsset *)asset; - -@end \ No newline at end of file diff --git a/src/ios/ELCImagePicker/ELCAsset.m b/src/ios/ELCImagePicker/ELCAsset.m deleted file mode 100644 index 12413af..0000000 --- a/src/ios/ELCImagePicker/ELCAsset.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// Asset.m -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import "ELCAsset.h" -#import "ELCAssetTablePicker.h" - -@implementation ELCAsset - -//Using auto synthesizers - -- (id)initWithAsset:(ALAsset*)asset -{ - self = [super init]; - if (self) { - self.asset = asset; - _selected = NO; - } - return self; -} - -- (void)toggleSelection -{ - self.selected = !self.selected; -} - -- (void)setSelected:(BOOL)selected -{ - if (selected) { - if ([_parent respondsToSelector:@selector(shouldSelectAsset:)]) { - if (![_parent shouldSelectAsset:self]) { - return; - } - } - } - _selected = selected; - if (selected) { - if (_parent != nil && [_parent respondsToSelector:@selector(assetSelected:)]) { - [_parent assetSelected:self]; - } - } -} - - -@end - diff --git a/src/ios/ELCImagePicker/ELCAssetCell.h b/src/ios/ELCImagePicker/ELCAssetCell.h deleted file mode 100644 index b907156..0000000 --- a/src/ios/ELCImagePicker/ELCAssetCell.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AssetCell.h -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import - - -@interface ELCAssetCell : UITableViewCell - -- (void)setAssets:(NSArray *)assets; - -@end diff --git a/src/ios/ELCImagePicker/ELCAssetCell.m b/src/ios/ELCImagePicker/ELCAssetCell.m deleted file mode 100644 index 2a6706a..0000000 --- a/src/ios/ELCImagePicker/ELCAssetCell.m +++ /dev/null @@ -1,117 +0,0 @@ -// -// AssetCell.m -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import "ELCAssetCell.h" -#import "ELCAsset.h" - -@interface ELCAssetCell () - -@property (nonatomic, strong) NSArray *rowAssets; -@property (nonatomic, strong) NSMutableArray *imageViewArray; -@property (nonatomic, strong) NSMutableArray *overlayViewArray; - -@end - -@implementation ELCAssetCell - -//Using auto synthesizers - -- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier -{ - self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; - if (self) { - UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(cellTapped:)]; - [self addGestureRecognizer:tapRecognizer]; - - NSMutableArray *mutableArray = [[NSMutableArray alloc] initWithCapacity:4]; - self.imageViewArray = mutableArray; - - NSMutableArray *overlayArray = [[NSMutableArray alloc] initWithCapacity:4]; - self.overlayViewArray = overlayArray; - } - return self; -} - -- (void)setAssets:(NSArray *)assets -{ - self.rowAssets = assets; - for (UIImageView *view in _imageViewArray) { - [view removeFromSuperview]; - } - for (UIImageView *view in _overlayViewArray) { - [view removeFromSuperview]; - } - //set up a pointer here so we don't keep calling [UIImage imageNamed:] if creating overlays - UIImage *overlayImage = nil; - for (int i = 0; i < [_rowAssets count]; ++i) { - - ELCAsset *asset = [_rowAssets objectAtIndex:i]; - - if (i < [_imageViewArray count]) { - UIImageView *imageView = [_imageViewArray objectAtIndex:i]; - imageView.image = [UIImage imageWithCGImage:asset.asset.thumbnail]; - } else { - UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithCGImage:asset.asset.thumbnail]]; - [_imageViewArray addObject:imageView]; - } - - if (i < [_overlayViewArray count]) { - UIImageView *overlayView = [_overlayViewArray objectAtIndex:i]; - overlayView.hidden = asset.selected ? NO : YES; - } else { - if (overlayImage == nil) { - overlayImage = [UIImage imageNamed:@"Overlay.png"]; - } - UIImageView *overlayView = [[UIImageView alloc] initWithImage:overlayImage]; - [_overlayViewArray addObject:overlayView]; - overlayView.hidden = asset.selected ? NO : YES; - } - } -} - -- (void)cellTapped:(UITapGestureRecognizer *)tapRecognizer -{ - CGPoint point = [tapRecognizer locationInView:self]; - CGFloat totalWidth = self.rowAssets.count * 75 + (self.rowAssets.count - 1) * 4; - CGFloat startX = (self.bounds.size.width - totalWidth) / 2; - - CGRect frame = CGRectMake(startX, 2, 75, 75); - - for (int i = 0; i < [_rowAssets count]; ++i) { - if (CGRectContainsPoint(frame, point)) { - ELCAsset *asset = [_rowAssets objectAtIndex:i]; - asset.selected = !asset.selected; - UIImageView *overlayView = [_overlayViewArray objectAtIndex:i]; - overlayView.hidden = !asset.selected; - break; - } - frame.origin.x = frame.origin.x + frame.size.width + 4; - } -} - -- (void)layoutSubviews -{ - CGFloat totalWidth = self.rowAssets.count * 75 + (self.rowAssets.count - 1) * 4; - CGFloat startX = (self.bounds.size.width - totalWidth) / 2; - - CGRect frame = CGRectMake(startX, 2, 75, 75); - - for (int i = 0; i < [_rowAssets count]; ++i) { - UIImageView *imageView = [_imageViewArray objectAtIndex:i]; - [imageView setFrame:frame]; - [self addSubview:imageView]; - - UIImageView *overlayView = [_overlayViewArray objectAtIndex:i]; - [overlayView setFrame:frame]; - [self addSubview:overlayView]; - - frame.origin.x = frame.origin.x + frame.size.width + 4; - } -} - - -@end diff --git a/src/ios/ELCImagePicker/ELCAssetPickerFilterDelegate.h b/src/ios/ELCImagePicker/ELCAssetPickerFilterDelegate.h deleted file mode 100644 index 478c256..0000000 --- a/src/ios/ELCImagePicker/ELCAssetPickerFilterDelegate.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ELCAssetPickerFilterDelegate.h - -@class ELCAsset; -@class ELCAssetTablePicker; - -@protocol ELCAssetPickerFilterDelegate - -// respond YES/NO to filter out (not show the asset) --(BOOL)assetTablePicker:(ELCAssetTablePicker *)picker isAssetFilteredOut:(ELCAsset *)elcAsset; - -@end \ No newline at end of file diff --git a/src/ios/ELCImagePicker/ELCAssetSelectionDelegate.h b/src/ios/ELCImagePicker/ELCAssetSelectionDelegate.h deleted file mode 100644 index 47d85d7..0000000 --- a/src/ios/ELCImagePicker/ELCAssetSelectionDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ELCAssetSelectionDelegate.h -// ELCImagePickerDemo -// -// Created by JN on 9/6/12. -// Copyright (c) 2012 ELC Technologies. All rights reserved. -// - -#import - -@class ELCAsset; - -@protocol ELCAssetSelectionDelegate - -- (void)selectedAssets:(NSArray *)assets; -- (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCount; - -@end diff --git a/src/ios/ELCImagePicker/ELCAssetTablePicker.h b/src/ios/ELCImagePicker/ELCAssetTablePicker.h deleted file mode 100644 index 8148ef6..0000000 --- a/src/ios/ELCImagePicker/ELCAssetTablePicker.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ELCAssetTablePicker.h -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import -#import -#import "ELCAsset.h" -#import "ELCAssetSelectionDelegate.h" -#import "ELCAssetPickerFilterDelegate.h" - -@interface ELCAssetTablePicker : UITableViewController - -@property (nonatomic, weak) id parent; -@property (nonatomic, strong) ALAssetsGroup *assetGroup; -@property (nonatomic, strong) NSMutableArray *elcAssets; -@property (nonatomic, strong) IBOutlet UILabel *selectedAssetsLabel; -@property (nonatomic, assign) BOOL singleSelection; -@property (nonatomic, assign) BOOL immediateReturn; - -// optional, can be used to filter the assets displayed -@property(nonatomic, weak) id assetPickerFilterDelegate; - -- (int)totalSelectedAssets; -- (void)preparePhotos; - -- (void)doneAction:(id)sender; - -@end \ No newline at end of file diff --git a/src/ios/ELCImagePicker/ELCAssetTablePicker.m b/src/ios/ELCImagePicker/ELCAssetTablePicker.m deleted file mode 100644 index f7a5a5a..0000000 --- a/src/ios/ELCImagePicker/ELCAssetTablePicker.m +++ /dev/null @@ -1,217 +0,0 @@ -// -// ELCAssetTablePicker.m -// -// Created by ELC on 2/15/11. -// Copyright 2011 ELC Technologies. All rights reserved. -// - -#import "ELCAssetTablePicker.h" -#import "ELCAssetCell.h" -#import "ELCAsset.h" -#import "ELCAlbumPickerController.h" - -@interface ELCAssetTablePicker () - -@property (nonatomic, assign) int columns; - -@end - -@implementation ELCAssetTablePicker - -//Using auto synthesizers - -- (id)init -{ - self = [super init]; - if (self) { - //Sets a reasonable default bigger then 0 for columns - //So that we don't have a divide by 0 scenario - self.columns = 4; - } - return self; -} - -- (void)viewDidLoad -{ - [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; - [self.tableView setAllowsSelection:NO]; - - NSMutableArray *tempArray = [[NSMutableArray alloc] init]; - self.elcAssets = tempArray; - - if (self.immediateReturn) { - - } else { - UIBarButtonItem *doneButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(doneAction:)]; - [self.navigationItem setRightBarButtonItem:doneButtonItem]; - [self.navigationItem setTitle:@"Loading..."]; - } - - [self performSelectorInBackground:@selector(preparePhotos) withObject:nil]; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - self.columns = self.view.bounds.size.width / 80; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - return YES; -} - -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation -{ - [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - self.columns = self.view.bounds.size.width / 80; - [self.tableView reloadData]; -} - -- (void)preparePhotos -{ - @autoreleasepool { - - [self.assetGroup enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { - - if (result == nil) { - return; - } - - ELCAsset *elcAsset = [[ELCAsset alloc] initWithAsset:result]; - [elcAsset setParent:self]; - - BOOL isAssetFiltered = NO; - if (self.assetPickerFilterDelegate && - [self.assetPickerFilterDelegate respondsToSelector:@selector(assetTablePicker:isAssetFilteredOut:)]) - { - isAssetFiltered = [self.assetPickerFilterDelegate assetTablePicker:self isAssetFilteredOut:(ELCAsset*)elcAsset]; - } - - if (!isAssetFiltered) { - [self.elcAssets addObject:elcAsset]; - } - - }]; - - dispatch_sync(dispatch_get_main_queue(), ^{ - [self.tableView reloadData]; - // scroll to bottom - long section = [self numberOfSectionsInTableView:self.tableView] - 1; - long row = [self tableView:self.tableView numberOfRowsInSection:section] - 1; - if (section >= 0 && row >= 0) { - NSIndexPath *ip = [NSIndexPath indexPathForRow:row - inSection:section]; - [self.tableView scrollToRowAtIndexPath:ip - atScrollPosition:UITableViewScrollPositionBottom - animated:NO]; - } - - [self.navigationItem setTitle:self.singleSelection ? @"Pick Photo" : @"Pick Photos"]; - }); - } -} - -- (void)doneAction:(id)sender -{ - NSMutableArray *selectedAssetsImages = [[NSMutableArray alloc] init]; - - for (ELCAsset *elcAsset in self.elcAssets) { - if ([elcAsset selected]) { - [selectedAssetsImages addObject:[elcAsset asset]]; - } - } - [self.parent selectedAssets:selectedAssetsImages]; -} - - -- (BOOL)shouldSelectAsset:(ELCAsset *)asset -{ - NSUInteger selectionCount = 0; - for (ELCAsset *elcAsset in self.elcAssets) { - if (elcAsset.selected) selectionCount++; - } - BOOL shouldSelect = YES; - if ([self.parent respondsToSelector:@selector(shouldSelectAsset:previousCount:)]) { - shouldSelect = [self.parent shouldSelectAsset:asset previousCount:selectionCount]; - } - return shouldSelect; -} - -- (void)assetSelected:(ELCAsset *)asset -{ - if (self.singleSelection) { - - for (ELCAsset *elcAsset in self.elcAssets) { - if (asset != elcAsset) { - elcAsset.selected = NO; - } - } - } - if (self.immediateReturn) { - NSArray *singleAssetArray = @[asset.asset]; - [(NSObject *)self.parent performSelector:@selector(selectedAssets:) withObject:singleAssetArray afterDelay:0]; - } -} - -#pragma mark UITableViewDataSource Delegate Methods - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - // Return the number of sections. - return 1; -} - - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - if (self.columns <= 0) { //Sometimes called before we know how many columns we have - self.columns = 4; - } - NSInteger numRows = ceil([self.elcAssets count] / (float)self.columns); - return numRows; -} - -- (NSArray *)assetsForIndexPath:(NSIndexPath *)path -{ - long index = path.row * self.columns; - long length = MIN(self.columns, [self.elcAssets count] - index); - return [self.elcAssets subarrayWithRange:NSMakeRange(index, length)]; -} - -// Customize the appearance of table view cells. -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - static NSString *CellIdentifier = @"Cell"; - - ELCAssetCell *cell = (ELCAssetCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - - if (cell == nil) { - cell = [[ELCAssetCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; - } - - [cell setAssets:[self assetsForIndexPath:indexPath]]; - - return cell; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return 79; -} - -- (int)totalSelectedAssets -{ - int count = 0; - - for (ELCAsset *asset in self.elcAssets) { - if (asset.selected) { - count++; - } - } - - return count; -} - - -@end diff --git a/src/ios/ELCImagePicker/ELCImagePickerController.h b/src/ios/ELCImagePicker/ELCImagePickerController.h deleted file mode 100644 index 0d1b54e..0000000 --- a/src/ios/ELCImagePicker/ELCImagePickerController.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// ELCImagePickerController.h -// ELCImagePickerDemo -// -// Created by ELC on 9/9/10. -// Copyright 2010 ELC Technologies. All rights reserved. -// - -#import -#import "ELCAssetSelectionDelegate.h" - -@class ELCImagePickerController; -@class ELCAlbumPickerController; - -@protocol ELCImagePickerControllerDelegate - -/** - * Called with the picker the images were selected from, as well as an array of dictionary's - * containing keys for ALAssetPropertyLocation, ALAssetPropertyType, - * UIImagePickerControllerOriginalImage, and UIImagePickerControllerReferenceURL. - * @param picker - * @param info An NSArray containing dictionary's with the key UIImagePickerControllerOriginalImage, which is a rotated, and sized for the screen 'default representation' of the image selected. If you want to get the original image, use the UIImagePickerControllerReferenceURL key. - */ -- (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info; - -/** - * Called when image selection was cancelled, by tapping the 'Cancel' BarButtonItem. - */ -- (void)elcImagePickerControllerDidCancel:(ELCImagePickerController *)picker; - -@end - -@interface ELCImagePickerController : UINavigationController - -@property (nonatomic, weak) id imagePickerDelegate; -@property (nonatomic, assign) NSInteger maximumImagesCount; - -/** - * YES if the picker should return the original image, - * or NO for an image suitable for displaying full screen on the device. - */ -@property (nonatomic, assign) BOOL returnsOriginalImage; - -- (id)initImagePicker; -- (void)cancelImagePicker; - -@end - diff --git a/src/ios/ELCImagePicker/ELCImagePickerController.m b/src/ios/ELCImagePicker/ELCImagePickerController.m deleted file mode 100644 index 7b2a931..0000000 --- a/src/ios/ELCImagePicker/ELCImagePickerController.m +++ /dev/null @@ -1,95 +0,0 @@ -// -// ELCImagePickerController.m -// ELCImagePickerDemo -// -// Created by ELC 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" -#import - -@implementation ELCImagePickerController - -//Using auto synthesizers - -- (id)initImagePicker -{ - ELCAlbumPickerController *albumPicker = [[ELCAlbumPickerController alloc] initWithStyle:UITableViewStylePlain]; - - self = [super initWithRootViewController:albumPicker]; - if (self) { - self.maximumImagesCount = 4; - [albumPicker setParent:self]; - } - return self; -} - -- (id)initWithRootViewController:(UIViewController *)rootViewController -{ - self = [super initWithRootViewController:rootViewController]; - if (self) { - self.maximumImagesCount = 4; - } - return self; -} - -- (void)cancelImagePicker -{ - if ([_imagePickerDelegate respondsToSelector:@selector(elcImagePickerControllerDidCancel:)]) { - [_imagePickerDelegate performSelector:@selector(elcImagePickerControllerDidCancel:) withObject:self]; - } -} - -- (BOOL)shouldSelectAsset:(ELCAsset *)asset previousCount:(NSUInteger)previousCount -{ - BOOL shouldSelect = previousCount < self.maximumImagesCount; - if (!shouldSelect) { - NSString *title = [NSString stringWithFormat:NSLocalizedString(@"Maximum %d photos.", nil), self.maximumImagesCount]; - NSString *message = [NSString stringWithFormat:NSLocalizedString(@"You can only select %d photos at a time.", nil), self.maximumImagesCount]; - [[[UIAlertView alloc] initWithTitle:title - message:message - delegate:nil - cancelButtonTitle:nil - otherButtonTitles:NSLocalizedString(@"Okay", nil), nil] show]; - } - return shouldSelect; -} - -- (void)selectedAssets:(NSArray *)assets -{ - NSMutableArray *returnArray = [[NSMutableArray alloc] init]; - - for(ALAsset *asset in assets) { - id obj = [asset valueForProperty:ALAssetPropertyType]; - if (!obj) { - continue; - } - NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init]; - [workingDictionary setObject:asset forKey:@"ALAsset"]; - [workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:UIImagePickerControllerReferenceURL]; - - [returnArray addObject:workingDictionary]; - - } - if (_imagePickerDelegate != nil && [_imagePickerDelegate respondsToSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:)]) { - [_imagePickerDelegate performSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:) withObject:self withObject:returnArray]; - } else { - [self popToRootViewControllerAnimated:NO]; - } -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { - return YES; - } else { - return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown; - } -} - -@end diff --git a/src/ios/ELCImagePicker/Resources/ELCAlbumPickerController.xib b/src/ios/ELCImagePicker/Resources/ELCAlbumPickerController.xib deleted file mode 100644 index 4170520..0000000 --- a/src/ios/ELCImagePicker/Resources/ELCAlbumPickerController.xib +++ /dev/null @@ -1,374 +0,0 @@ - - - - 1024 - 10F569 - 804 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - {320, 416} - - - 3 - MQA - - NO - YES - NO - - - NO - - IBCocoaTouchFramework - NO - 1 - 0 - YES - 44 - 22 - 22 - - - - - YES - - - view - - - - 5 - - - - dataSource - - - - 6 - - - - delegate - - - - 7 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 4 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 4.IBEditorWindowLastContentRect - 4.IBPluginDependency - - - YES - AlbumPickerController - UIResponder - {{329, 504}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 7 - - - - YES - - AlbumPickerController - UITableViewController - - IBProjectSource - Classes/AlbumPickerController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UITableViewController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITableViewController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../ELCImagePickerDemo.xcodeproj - 3 - 123 - - diff --git a/src/ios/ELCImagePicker/Resources/ELCAssetPicker.xib b/src/ios/ELCImagePicker/Resources/ELCAssetPicker.xib deleted file mode 100644 index 5d5e2b5..0000000 --- a/src/ios/ELCImagePicker/Resources/ELCAssetPicker.xib +++ /dev/null @@ -1,435 +0,0 @@ - - - - 1024 - 10F569 - 804 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - YES - - - 268 - {320, 416} - - - 1 - MSAxIDEAA - - YES - YES - IBCocoaTouchFramework - - - {320, 416} - - - 3 - MQA - - 2 - - - - - NO - - IBCocoaTouchFramework - - - - - YES - - - view - - - - 3 - - - - scrollview - - - - 7 - - - - - YES - - 0 - - - - - - 1 - - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 6 - - - YES - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 1.IBEditorWindowLastContentRect - 1.IBPluginDependency - 6.IBPluginDependency - 6.IBViewBoundsToFrameTransform - - - YES - AssetPicker - UIResponder - {{575, 376}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - P4AAAL+AAAAAAAAAw88AAA - - - - - YES - - - YES - - - - - YES - - - YES - - - - 15 - - - - YES - - AssetPicker - UIViewController - - dismiss: - id - - - dismiss: - - dismiss: - id - - - - YES - - YES - parent - scrollview - selectedAssetsLabel - - - YES - id - UIScrollView - UILabel - - - - YES - - YES - parent - scrollview - selectedAssetsLabel - - - YES - - parent - id - - - scrollview - UIScrollView - - - selectedAssetsLabel - UILabel - - - - - IBProjectSource - Classes/ELCImagePickerController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../ELCImagePickerDemo.xcodeproj - 3 - 123 - - diff --git a/src/ios/ELCImagePicker/Resources/ELCAssetTablePicker.xib b/src/ios/ELCImagePicker/Resources/ELCAssetTablePicker.xib deleted file mode 100644 index e59456c..0000000 --- a/src/ios/ELCImagePicker/Resources/ELCAssetTablePicker.xib +++ /dev/null @@ -1,422 +0,0 @@ - - - - 1024 - 10F569 - 804 - 1038.29 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 123 - - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - {320, 436} - - - 3 - MQA - - YES - - NO - - IBCocoaTouchFramework - YES - 1 - 0 - YES - 44 - 22 - 22 - - - - - YES - - - view - - - - 3 - - - - dataSource - - - - 4 - - - - delegate - - - - 5 - - - - - YES - - 0 - - - - - - -1 - - - File's Owner - - - -2 - - - - - 2 - - - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - - - YES - AssetTablePicker - UIResponder - {{0, 526}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - YES - - - - - YES - - - YES - - - - 5 - - - - YES - - AssetTablePicker - UITableViewController - - dismiss: - id - - - dismiss: - - dismiss: - id - - - - YES - - YES - parent - selectedAssetsLabel - - - YES - id - UILabel - - - - YES - - YES - parent - selectedAssetsLabel - - - YES - - parent - id - - - selectedAssetsLabel - UILabel - - - - - IBProjectSource - Classes/ELCImagePickerController.h - - - - - YES - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIAccessibility.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UINibLoading.h - - - - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UIResponder.h - - - - UILabel - UIView - - IBFrameworkSource - UIKit.framework/Headers/UILabel.h - - - - UIResponder - NSObject - - - - UIScrollView - UIView - - IBFrameworkSource - UIKit.framework/Headers/UIScrollView.h - - - - UISearchBar - UIView - - IBFrameworkSource - UIKit.framework/Headers/UISearchBar.h - - - - UISearchDisplayController - NSObject - - IBFrameworkSource - UIKit.framework/Headers/UISearchDisplayController.h - - - - UITableView - UIScrollView - - IBFrameworkSource - UIKit.framework/Headers/UITableView.h - - - - UITableViewController - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITableViewController.h - - - - UIView - - IBFrameworkSource - UIKit.framework/Headers/UITextField.h - - - - UIView - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIView.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UINavigationController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UIPopoverController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UISplitViewController.h - - - - UIViewController - - IBFrameworkSource - UIKit.framework/Headers/UITabBarController.h - - - - UIViewController - UIResponder - - IBFrameworkSource - UIKit.framework/Headers/UIViewController.h - - - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - - - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - ../ELCImagePickerDemo.xcodeproj - 3 - 123 - - diff --git a/src/ios/ELCImagePicker/Resources/Overlay.png b/src/ios/ELCImagePicker/Resources/Overlay.png deleted file mode 100644 index a86f47f..0000000 Binary files a/src/ios/ELCImagePicker/Resources/Overlay.png and /dev/null differ diff --git a/src/ios/ELCImagePicker/Resources/Overlay@2x.png b/src/ios/ELCImagePicker/Resources/Overlay@2x.png deleted file mode 100644 index a6fd78c..0000000 Binary files a/src/ios/ELCImagePicker/Resources/Overlay@2x.png and /dev/null differ