| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- //
- // ExpertCollectionViewCell.m
- // jitao
- //
- // Created by 罗云飞 on 2018/2/6.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "ExpertCollectionViewCell.h"
- @implementation ExpertCollectionViewCell
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- _headimage = [UIImageView new];
- _headimage.backgroundColor = NewClearColor;
- [self.contentView addSubview:_headimage];
-
- _headimage.sd_layout
- .topSpaceToView(self.contentView, 22)
- .leftSpaceToView(self.contentView, 15)
- .heightIs(64)
- .widthIs(64);
- ViewRadius(_headimage, 64/2);
-
-
- _name = [UILabel new];
- _name.textColor = NewBlackColor;
- _name.font = NewFont(14);
- [_name setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_name];
-
- _name.sd_layout
- .leftSpaceToView(_headimage, 15)
- .topSpaceToView(self.contentView, 15)
- .heightIs(13);
-
- _industry = [UILabel new];
- _industry.textColor = [UIColor colorWithString:@"#3C3C3C"];
- _industry.font = NewFont(11);
- [_industry setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_industry];
-
- _industry.sd_layout
- .leftSpaceToView(_name, 15)
- .bottomEqualToView(_name)
- .heightIs(11);
-
- UILabel *line1 = [UILabel new];
- line1.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line1];
-
- line1.sd_layout
- .leftEqualToView(_name)
- .topSpaceToView(self.contentView, 36)
- .heightIs(0.8)
- .rightEqualToView(self.contentView);
-
- _briefintroduction = [UILabel new];
- _briefintroduction.textColor = [UIColor colorWithString:@"#9A9A9A"];
- _briefintroduction.font = NewFont(12);
- _briefintroduction.lineBreakMode = NSLineBreakByTruncatingTail;
- _briefintroduction.numberOfLines = 2;
- [self.contentView addSubview:_briefintroduction];
-
- _briefintroduction.sd_layout
- .topSpaceToView(line1, 7)
- .leftEqualToView(line1)
- .heightIs(35)
- .rightSpaceToView(self.contentView, 23);
-
- // _Negotiate = [UILabel new];
- // _Negotiate.text = [NSString stringWithFormat:@"%@次洽谈",@"60"];
- // _Negotiate.font = NewFont(12);
- // _Negotiate.textColor = [UIColor colorWithString:@"#1797E9"];
- // [_Negotiate setSingleLineAutoResizeWithMaxWidth:0];
- //// [self.contentView addSubview:_Negotiate];
- //
- // _Negotiate.sd_layout
- // .leftEqualToView(line1)
- // .bottomSpaceToView(self.contentView, 10)
- // .heightIs(12);
-
- _appointment = [UILabel new];
- _appointment.font = NewFont(12);
- _appointment.textColor = [UIColor colorWithString:@"#FF8523"];
- [_appointment setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_appointment];
-
- _appointment.sd_layout
- .rightSpaceToView(self.contentView, 15)
- .topSpaceToView(self.contentView, 95)
- .heightIs(12);
-
- _line3 = [UILabel new];
- _line3.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:_line3];
-
- _line3.sd_layout
- .leftEqualToView(self.contentView)
- .rightEqualToView(self.contentView)
- .heightIs(5)
- .bottomEqualToView(self.contentView);
-
- _line4 = [UILabel new];
- _line4.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:_line4];
-
- _line4.sd_layout
- .leftEqualToView(self.contentView)
- .heightIs(1)
- .rightEqualToView(self.contentView)
- .bottomSpaceToView(self.contentView, 44);
-
- _seemoreBT = [UIButton new];
- _seemoreBT.backgroundColor = NewWhiteColor;
- [self.contentView addSubview:_seemoreBT];
-
- _seemoreBT.sd_layout
- .leftEqualToView(self.contentView)
- .topSpaceToView(_line4, 0)
- .bottomSpaceToView(self.contentView, 1)
- .rightEqualToView(self.contentView);
-
- UILabel *gengduo = [UILabel new];
- gengduo.text = @"查看更多专家";
- gengduo.font = NewFont(12);
- gengduo.textColor = [UIColor colorWithString:@"#A1A1A1"];
- [gengduo setSingleLineAutoResizeWithMaxWidth:0];
- [_seemoreBT addSubview:gengduo];
-
- gengduo.sd_layout
- .centerXEqualToView(_seemoreBT)
- .topSpaceToView(_seemoreBT, 1)
- .bottomSpaceToView(_seemoreBT, 1);
-
- UIImageView *imgeview = [UIImageView new];
- [imgeview setImage:[UIImage imageNamed:@"括号"]];
- [_seemoreBT addSubview:imgeview];
-
- imgeview.sd_layout
- .leftSpaceToView(gengduo, 10)
- .heightIs(13)
- .widthIs(7)
- .centerYEqualToView(_seemoreBT);
- }
- return self;
- }
- - (void)assignment:(HomeExpertModel *)model {
- [_headimage sd_setImageWithURL:NewURL([model.headPortraitUrl mosaicUrlPrefix]) placeholderImage:[UIImage imageNamed:@"zjtx"]];
- _name.text = model.name;
- if (model.workUnit == NULL && model.professionalTitle == NULL) {
- _industry.text = @"";
- }else if(model.workUnit == NULL){
- _industry.text = model.professionalTitle;
- }else if (model.professionalTitle == NULL){
- _industry.text = model.workUnit;
- }else{
- _industry.text = [NSString stringWithFormat:@"%@%@",model.workUnit,model.professionalTitle];
- }
- _briefintroduction.text = model.introduction;
- _appointment.text = [NSString stringWithFormat:@"%@次预约",model.reservationCount];
- }
- @end
|