mirror of
https://gitee.com/shuto/cordova-imagePicker.git
synced 2026-05-23 00:05:03 +08:00
Made appearance closer to the stock Photos app.
I got rid of the lines between the albums. Also I put some padding around the album thumbnails. See this screenshot for the improvements: http://monosnap.com/image/wcBd9YW65Y0AWFAVhUy0xgLoUx0pV5 I have created a similar pull request for the original ELCImagePickerController project: https://github.com/B-Sides/ELCImagePickerController/pull/98
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
|
||||
|
||||
[self.navigationItem setTitle:@"Loading..."];
|
||||
|
||||
@@ -131,12 +132,26 @@
|
||||
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]]];
|
||||
UIImage* image = [UIImage imageWithCGImage:[(ALAssetsGroup*)[self.assetGroups objectAtIndex:indexPath.row] posterImage]];
|
||||
image = [self resize:image to:CGSizeMake(78, 78)];
|
||||
[cell.imageView setImage:image];
|
||||
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
// Resize a UIImage. From http://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage
|
||||
- (UIImage *)resize:(UIImage *)image to:(CGSize)newSize {
|
||||
//UIGraphicsBeginImageContext(newSize);
|
||||
// In next line, pass 0.0 to use the current device's pixel scaling factor (and thus account for Retina resolution).
|
||||
// Pass 1.0 to force exact pixel size.
|
||||
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
|
||||
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
|
||||
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
return newImage;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Table view delegate
|
||||
|
||||
@@ -157,7 +172,7 @@
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return 57;
|
||||
return 95;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user