UzysGroupViewCell.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // uzysGroupViewCell.m
  3. // UzysAssetsPickerController
  4. //
  5. // Created by Uzysjung on 2014. 2. 13..
  6. // Copyright (c) 2014년 Uzys. All rights reserved.
  7. //
  8. // 版权属于原作者
  9. // http://code4app.com(cn) http://code4app.net(en)
  10. // 来源于最专业的源码分享网站: Code4App
  11. #import "UzysAssetsPickerController_Configuration.h"
  12. #import "UzysGroupViewCell.h"
  13. @implementation UzysGroupViewCell
  14. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  15. {
  16. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  17. if (self) {
  18. // Initialization code
  19. self.textLabel.font = [UIFont fontWithName:@"AppleSDGothicNeo-Medium" size:17];
  20. self.detailTextLabel.font = [UIFont fontWithName:@"AppleSDGothicNeo-Medium" size:11];
  21. self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"UzysAssetPickerController.bundle/uzysAP_ico_checkMark"]];
  22. self.selectedBackgroundView = nil;
  23. self.selectionStyle = UITableViewCellSelectionStyleNone;
  24. }
  25. return self;
  26. }
  27. - (void)setSelected:(BOOL)selected animated:(BOOL)animated
  28. {
  29. [super setSelected:selected animated:animated];
  30. // Configure the view for the selected state
  31. if(selected)
  32. {
  33. self.accessoryView.hidden = NO;
  34. }
  35. else
  36. {
  37. self.accessoryView.hidden = YES;
  38. }
  39. }
  40. - (void)applyData:(ALAssetsGroup *)assetsGroup
  41. {
  42. self.assetsGroup = assetsGroup;
  43. CGImageRef posterImage = assetsGroup.posterImage;
  44. size_t height = CGImageGetHeight(posterImage);
  45. float scale = height / kThumbnailLength;
  46. self.imageView.image = [UIImage imageWithCGImage:posterImage scale:scale orientation:UIImageOrientationUp];
  47. self.textLabel.text = [assetsGroup valueForProperty:ALAssetsGroupPropertyName];
  48. self.detailTextLabel.text = [NSString stringWithFormat:@"%ld", (long)[assetsGroup numberOfAssets]];
  49. self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  50. }
  51. @end