RITLPhotosGroupCell.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // YPPhotoGroupCell.m
  3. // YPPhotoDemo
  4. //
  5. // Created by YueWen on 16/7/13.
  6. // Copyright © 2017年 YueWen. All rights reserved.
  7. //
  8. #import "RITLPhotosGroupCell.h"
  9. #import "NSBundle+RITLPhotos.h"
  10. #import "RITLKit.h"
  11. #import "Masonry.h"
  12. //static NSString *const RITLGroupTableViewControllerRightArrowImageName = @"RITLPhotos.bundle/ritl_arrow_right";
  13. @implementation RITLPhotosGroupCell
  14. @synthesize imageView = _imageView,titleLabel = _titleLabel;
  15. -(void)dealloc
  16. {
  17. #ifdef RITLDebug
  18. // NSLog(@"YPPhotoGroupCell Dealloc");
  19. #endif
  20. }
  21. -(void)prepareForReuse
  22. {
  23. [super prepareForReuse];
  24. _imageView.image = nil;
  25. _titleLabel.text = @"";
  26. }
  27. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  28. {
  29. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
  30. {
  31. [self photoGroupCellWillLoad];
  32. }
  33. return self;
  34. }
  35. - (void)awakeFromNib
  36. {
  37. [super awakeFromNib];
  38. // Initialization code
  39. [self photoGroupCellWillLoad];
  40. }
  41. - (void)photoGroupCellWillLoad
  42. {
  43. [self addSubImageView];
  44. [self addSubTitleLabel];
  45. [self addSubArrowImageView];
  46. }
  47. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  48. [super setSelected:selected animated:animated];
  49. // Configure the view for the selected state
  50. }
  51. #pragma mark - AddSubviews
  52. - (void)addSubImageView
  53. {
  54. _imageView = [[UIImageView alloc]init];
  55. _imageView.contentMode = UIViewContentModeScaleAspectFill;
  56. _imageView.clipsToBounds = true;
  57. [self.contentView addSubview:_imageView];
  58. [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.top.mas_equalTo(0);
  60. make.bottom.mas_equalTo(0);
  61. make.leading.mas_equalTo(10);
  62. make.width.equalTo(self.imageView.mas_height);
  63. }];
  64. }
  65. - (void)addSubTitleLabel
  66. {
  67. _titleLabel = [[UILabel alloc]init];
  68. _titleLabel.font = [UIFont systemFontOfSize:15];
  69. [self.contentView addSubview:_titleLabel];
  70. [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.centerY.equalTo(self.contentView.mas_centerY);
  72. make.left.equalTo(self.imageView.mas_right).offset(10);
  73. make.right.equalTo(self.contentView).offset(-10);
  74. }];
  75. }
  76. - (void)addSubArrowImageView
  77. {
  78. _arrowImageView = [[UIImageView alloc]init];
  79. _arrowImageView.image = /*RITLGroupTableViewControllerRightArrowImageName.ritl_image*/NSBundle.ritl_arrow_right;
  80. [self.contentView addSubview:_arrowImageView];
  81. [_arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.right.inset(15);
  83. make.centerY.offset(0);
  84. make.size.mas_equalTo(CGSizeMake(15, 15));
  85. }];
  86. }
  87. @end