// // FKShareListCell.m // FirstLink // // Created by jack on 16/4/9. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKShareListCell.h" @implementation FKShareListCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { [self addAllSubviews]; self.selectionStyle = UITableViewCellSelectionStyleNone; } return self; } - (void)addAllSubviews{ UIView *bottomLine = [[UIView alloc]init]; bottomLine.backgroundColor = UIColorFromRGB(0xe5e5e5); [self.contentView addSubview:self.selectBtn]; [self.contentView addSubview:self.imgView]; [self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:bottomLine]; [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView); make.centerY.equalTo(self.contentView); make.size.mas_equalTo(CGSizeMake(48, 45)); }]; [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.selectBtn.mas_right); make.centerY.equalTo(self.contentView); make.size.mas_equalTo(CGSizeMake([FKShareListCell imageViewMargin], [FKShareListCell imageViewMargin])); }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.imgView.mas_right).offset(15); make.centerY.equalTo(self.imgView); make.right.equalTo(self.contentView).offset(- 15); }]; [bottomLine mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.imgView); make.right.bottom.equalTo(self.contentView); make.height.mas_equalTo(0.5); }]; } + (CGFloat)imageViewMargin{ return 80; } #pragma mark - property - (UIButton *)selectBtn{ if (_selectBtn == nil) { _selectBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_selectBtn setImage:[UIImage imageNamed:@"basket_unSelect"] forState:UIControlStateNormal]; [_selectBtn setImage:[UIImage imageNamed:@"basket_selected"] forState:UIControlStateSelected]; } return _selectBtn; } - (UILabel *)titleLabel{ if (_titleLabel == nil) { if (_titleLabel == nil) { _titleLabel = [[UILabel alloc]init]; _titleLabel.font = [UIFont systemFontOfSize:13]; _titleLabel.textColor = UIColorFromRGB(0x333333); _titleLabel.numberOfLines = 2; } } return _titleLabel; } - (UIImageView *)imgView{ if (_imgView == nil) { _imgView = [[UIImageView alloc]init]; } return _imgView; } @end