猎豆优选

LDAdversementCell.m 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // LDAdversementCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LDAdversementCell.h"
  9. @interface LDAdversementCell ()
  10. @property (nonatomic, strong) UIImageView *iconView;
  11. @end
  12. @implementation LDAdversementCell
  13. + (instancetype)cellWithTableView:(UITableView *)tableView {
  14. static NSString *cellID = nil;
  15. cellID = NSStringFromClass([self class]);
  16. LDAdversementCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  17. if (!cell) {
  18. cell = [[LDAdversementCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  19. }
  20. return cell;
  21. }
  22. - (void)awakeFromNib {
  23. [super awakeFromNib];
  24. // Initialization code
  25. }
  26. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  27. [super setSelected:selected animated:animated];
  28. // Configure the view for the selected state
  29. }
  30. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  31. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  32. if (self) {
  33. [self.contentView addSubview:self.iconView];
  34. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.top.right.bottom.mas_equalTo(0);
  36. }];
  37. }
  38. return self;
  39. }
  40. - (void)setModel:(LDChildGoodModel *)model {
  41. _model = model;
  42. [_iconView sd_setImageWithURL:[NSURL URLWithString:model.photo]];
  43. }
  44. - (UIImageView *)iconView {
  45. if (!_iconView) {
  46. _iconView = [[UIImageView alloc] init];
  47. _iconView.backgroundColor = [UIColor yhGrayColor];
  48. }
  49. return _iconView;
  50. }
  51. @end