// // KBAdversementCell.m // YouHuiProject // // Created by 小花 on 2018/1/25. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBAdversementCell.h" @interface KBAdversementCell () @property (nonatomic, strong) UIImageView *iconView; @end @implementation KBAdversementCell + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *cellID = nil; cellID = NSStringFromClass([self class]); KBAdversementCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (!cell) { cell = [[KBAdversementCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; } return cell; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self.contentView addSubview:self.iconView]; [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.bottom.mas_equalTo(0); }]; } return self; } - (void)setModel:(KBChildGoodModel *)model { _model = model; [_iconView sd_setImageWithURL:[NSURL URLWithString:model.photo]]; } - (UIImageView *)iconView { if (!_iconView) { _iconView = [[UIImageView alloc] init]; _iconView.backgroundColor = [UIColor yhGrayColor]; } return _iconView; } @end