1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //
- // LDGoodDetailImageCell.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/11/13.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LDGoodDetailImageCell.h"
- @interface LDGoodDetailImageCell ()
- @property (nonatomic, strong) UIImageView *imgView;
- @end
- @implementation LDGoodDetailImageCell
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *cellID = nil;
- cellID = NSStringFromClass([self class]);
- LDGoodDetailImageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
- if (!cell) {
- cell = [[LDGoodDetailImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.backgroundColor=[UIColor yhGrayColor];
- }
- 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 initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- [self.contentView addSubview:self.imgView];
- [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.top.bottom.mas_equalTo(0);
- }];
- }
- - (void)setModel:(LDDetailImgModel *)model {
- [self.imgView sd_setFadeImageWithURL:[NSURL URLWithString:model.url] placeholderImage:nil options:0 progress:nil completed:nil];
- }
- - (UIImageView *)imgView {
- if (!_imgView) {
- _imgView = [[UIImageView alloc] init];
- _imgView.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _imgView;
- }
- @end
|