// // KBRollingCollectionViewCell.m // YouHuiProject // // Created by jcymac on 2018/10/15. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBRollingCollectionViewCell.h" @implementation KBRollingCollectionViewCell -(id)initWithFrame:(CGRect)frame { self=[super initWithFrame:frame]; if(self) { [self makeUI]; } return self; } -(void)makeUI { [self.contentView addSubview:self.headImageView]; [self.contentView addSubview:self.titleLable]; [self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.centerY.mas_equalTo(self.contentView.mas_centerY); make.width.height.mas_equalTo(27); }]; [self.titleLable mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.headImageView.mas_right).offset(5); make.centerY.mas_equalTo(self.contentView.mas_centerY); }]; } - (UIImageView *)headImageView { if (!_headImageView) { _headImageView=[[UIImageView alloc] init]; _headImageView.clipsToBounds=YES; _headImageView.layer.cornerRadius=10; _headImageView.backgroundColor=[UIColor redColor]; } return _headImageView; } - (UILabel *)titleLable { if (!_titleLable) { _titleLable=[[UILabel alloc] init]; _titleLable.font=[UIFont systemFontOfSize:12]; _titleLable.textColor=[UIColor colorWithHexString:@"#333333"]; } return _titleLable; } -(void)setModel:(KBSignInRollingUser *)model { _model=model; [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"signUserHead"]]; self.titleLable.text = _model.res; [self.titleLable mas_updateConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.headImageView.mas_right).offset(5); make.centerY.mas_equalTo(self.contentView.mas_centerY); }]; } @end