Skip to content

Commit

Permalink
Merge branch 'improve-appearance' of https://github.com/JonathanAquin…
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jun 4, 2015
2 parents 4452872 + 665f351 commit 1735907
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/ios/ELCImagePicker/ELCAlbumPickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ @implementation ELCAlbumPickerController
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

[self.navigationItem setTitle:@"Loading..."];

Expand Down Expand Up @@ -131,12 +132,26 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
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

Expand All @@ -157,7 +172,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 57;
return 95;
}

@end
Expand Down

0 comments on commit 1735907

Please sign in to comment.