Skip to content

Commit

Permalink
added scrollToBottom property for image picker, fixed 'Pick Photos' i…
Browse files Browse the repository at this point in the history
…n single selection mode
  • Loading branch information
jnutting committed Sep 6, 2012
1 parent 09246df commit 01dfb6c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions Classes/ELCAssetTablePicker.h
Expand Up @@ -28,6 +28,7 @@
@property (nonatomic, retain) IBOutlet UILabel *selectedAssetsLabel;
@property (nonatomic, assign) BOOL singleSelection;
@property (nonatomic, assign) BOOL immediateReturn;
@property (nonatomic, assign) BOOL startAtBottom;

-(int)totalSelectedAssets;
-(void)preparePhotos;
Expand Down
13 changes: 11 additions & 2 deletions Classes/ELCAssetTablePicker.m
Expand Up @@ -84,9 +84,18 @@ -(void)preparePhotos {
[self.elcAssets addObject:elcAsset];
}];
NSLog(@"done enumerating photos");
[self.tableView reloadData];
[self.navigationItem setTitle:@"Pick Photos"];
// scroll to bottom
int section = [self numberOfSectionsInTableView:self.tableView] - 1;
int row = [self tableView:self.tableView numberOfRowsInSection:section] - 1;
NSIndexPath *ip = [NSIndexPath indexPathForRow:row
inSection:section];
[self.tableView scrollToRowAtIndexPath:ip
atScrollPosition:UITableViewScrollPositionBottom
animated:NO];

[self.navigationItem setTitle:self.singleSelection ? @"Pick Photo" : @"Pick Photos"];

[pool release];

Expand Down
2 changes: 2 additions & 0 deletions Classes/ELCImagePickerDemoViewController.m
Expand Up @@ -56,6 +56,8 @@ - (void)displayPickerForGroup:(ALAssetsGroup *)group {
ELCAssetTablePicker *tablePicker = [[ELCAssetTablePicker alloc] initWithNibName:@"ELCAssetTablePicker" bundle:[NSBundle mainBundle]];
tablePicker.singleSelection = YES;
tablePicker.immediateReturn = YES;
tablePicker.startAtBottom = YES;

ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initWithRootViewController:tablePicker];
elcPicker.delegate = self;
tablePicker.parent = elcPicker;
Expand Down

0 comments on commit 01dfb6c

Please sign in to comment.