Permalink
Browse files

added scrollToBottom property for image picker, fixed 'Pick Photos' i…

…n single selection mode
  • Loading branch information...
1 parent 09246df commit 01dfb6c0e5c11eda2f697ec68d28f166c677e331 @jnutting jnutting committed Sep 6, 2012
Showing with 14 additions and 2 deletions.
  1. +1 −0 Classes/ELCAssetTablePicker.h
  2. +11 −2 Classes/ELCAssetTablePicker.m
  3. +2 −0 Classes/ELCImagePickerDemoViewController.m
@@ -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;
@@ -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];
@@ -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;

0 comments on commit 01dfb6c

Please sign in to comment.