// // NewFWXMCell.m // jitao // // Created by 罗云飞 on 2018/8/30. // Copyright © 2018年 罗云飞. All rights reserved. // #import "NewFWXMCell.h" @implementation NewFWXMCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { _imageview = [UIImageView new]; [self.contentView addSubview:_imageview]; _imageview.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(self.contentView, 30) .heightIs(65) .widthIs(100); _guanzhuBT = [UIButton new]; [_guanzhuBT setBackgroundImage:NewImageNamed(@"wpj") forState:UIControlStateNormal]; [self.contentView addSubview:_guanzhuBT]; _guanzhuBT.sd_layout .rightSpaceToView(self.contentView, 15) .heightIs(15) .widthIs(15) .topEqualToView(_imageview); _guanzhuNumber = [UILabel new]; _guanzhuNumber.font = NewFont(13); [_guanzhuNumber setTextColor:[UIColor colorWithString:@"#AEAEAE"]]; [_guanzhuNumber setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_guanzhuNumber]; _guanzhuNumber.sd_layout .centerYEqualToView(_guanzhuBT) .heightIs(15) .rightSpaceToView(_guanzhuBT, 5); _title = [UILabel new]; _title.font = NewFont(16); // [_title setSingleLineAutoResizeWithMaxWidth:0]; _title.textAlignment = NSTextAlignmentLeft; [self.contentView addSubview:_title]; _title.sd_layout .leftSpaceToView(_imageview, 15) .topEqualToView(_imageview) .heightIs(15) .rightSpaceToView(_guanzhuNumber, 15); UILabel *line = [UILabel new]; line.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line]; line.sd_layout .leftSpaceToView(_imageview, 15) .heightIs(0.8) .rightSpaceToView(self.contentView, 15) .topSpaceToView(self.contentView, 55); _neirong = [UILabel new]; _neirong.font = NewFont(14); _neirong.lineBreakMode = NSLineBreakByTruncatingTail; _neirong.numberOfLines = 1; _neirong.textColor = [UIColor colorWithString:@"#6C6C6C"]; [self.contentView addSubview:_neirong]; _neirong.sd_layout .leftEqualToView(line) .heightIs(15) .topSpaceToView(line, 5) .rightSpaceToView(self.contentView, 15); _jiage = [UILabel new]; _jiage.textColor = [UIColor colorWithString:@"#0779D5"]; _jiage.font = NewFont(15); [_jiage setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_jiage]; _jiage.sd_layout .leftEqualToView(_neirong) .heightIs(15) .topSpaceToView(_neirong, 10); _gongsi = [UILabel new]; _gongsi.font = NewFont(13); [_gongsi setSingleLineAutoResizeWithMaxWidth:0]; _gongsi.textColor = [UIColor colorWithString:@"#6C6C6C"]; [self.contentView addSubview:_gongsi]; _gongsi.sd_layout .leftEqualToView(line) .heightIs(15) .bottomSpaceToView(self.contentView, 15); _banliBT = [UIButton new]; [_banliBT setTitle:@"立即办理" forState:UIControlStateNormal]; [_banliBT setTitleColor:[UIColor colorWithString:@"#0779D5"] forState:UIControlStateNormal]; ViewBorderRadius(_banliBT, 3, 1, [UIColor colorWithString:@"#0779D5"]); _banliBT.titleLabel.font = NewFont(13); [self.contentView addSubview:_banliBT]; _banliBT.sd_layout .rightSpaceToView(self.contentView, 15) .heightIs(20) .widthIs(70) .bottomEqualToView(_gongsi); UILabel *line1 = [UILabel new]; line1.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line1]; line1.sd_layout .leftEqualToView(self.contentView) .rightEqualToView(self.contentView) .bottomEqualToView(self.contentView) .heightIs(0.8); } return self; } - (void)assignment:(NewFWXMModel *)model { [_imageview sd_setImageWithURL:NewURL([model.minImgUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"服务项目")]; [_title setText:model.name]; _guanzhuNumber.text = model.interestCount; if (model.companyName == NULL) { [_gongsi setText:@"未知发布者"]; }else{ [_gongsi setText:model.companyName]; } if (model.advertisement == NULL || [model.advertisement isEqualToString:@""]) { _neirong.text = @"暂无简介"; }else{ _neirong.text = model.advertisement; } if (model.price == NULL) { _jiage.text = @"面议"; }else{ _jiage.text = [NSString stringWithFormat:@"¥%@万元",model.price]; } } - (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 } @end