// // MyresultsCell.m // jitao // // Created by 罗云飞 on 2017/12/8. // Copyright © 2017年 罗云飞. All rights reserved. // #import "MyresultsCell.h" @implementation MyresultsCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { UILabel *line = [UILabel new]; line.backgroundColor = NewNavigationColor; [self.contentView addSubview:line]; line.sd_layout .leftEqualToView(self.contentView) .topEqualToView(self.contentView) .rightEqualToView(self.contentView) .heightIs(10); _title = [UILabel new]; _title.font = NewFont(14); _title.textColor = [UIColor colorWithString:@"#3C3C3C"]; //设置 label的换行模式 _title.lineBreakMode = NSLineBreakByTruncatingTail; //根据单词进行换行 //设置label显示几行 可以有无限行 _title.numberOfLines = 1; [self.contentView addSubview:_title]; _title.sd_layout .leftSpaceToView(self.contentView, 15) .rightSpaceToView(self.contentView, 15) .topSpaceToView(line, 0) .heightIs(fitScreenWidth(44)); UILabel *line1 = [UILabel new]; line1.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line1]; line1.sd_layout .leftEqualToView(self.contentView) .topSpaceToView(_title, 1) .rightEqualToView(self.contentView) .heightIs(0.8); _resultscategory = [UIButton new]; [_resultscategory setTitleColor:NewButtonColor forState:UIControlStateNormal]; _resultscategory.titleLabel.font = NewFont(12); ViewBorderRadius(_resultscategory, 3, 1, NewButtonColor); [self.contentView addSubview:_resultscategory]; _resultscategory.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(line1, 15) .heightIs(fitScreenWidth(26)) .widthIs(fitScreenWidth(100)); // UILabel *negotiate = [UILabel new]; // negotiate.text = @"洽谈:"; // negotiate.font = NewFont(12); // negotiate.textColor = NewBlackColor; // [negotiate setSingleLineAutoResizeWithMaxWidth:0]; // [self.contentView addSubview:negotiate]; // // negotiate.sd_layout // .centerYEqualToView(_resultscategory) // .rightSpaceToView(self.contentView, SCREEN_WIDTH/2) // .heightIs(fitScreenWidth(12)); // // _negotiatenumber = [UILabel new]; // _negotiatenumber.textColor = [UIColor colorWithString:@"#F46A6A"]; // _negotiatenumber.font = NewBFont(15); // [_negotiatenumber setSingleLineAutoResizeWithMaxWidth:0]; // [self.contentView addSubview:_negotiatenumber]; // // _negotiatenumber.sd_layout // .leftSpaceToView(self.contentView, SCREEN_WIDTH/2) // .centerYEqualToView(negotiate) // .heightIs(fitScreenWidth(15)); _purchaseintentionnumber = [UILabel new]; _purchaseintentionnumber.textColor = [UIColor colorWithString:@"#F46A6A"]; _purchaseintentionnumber.font = NewBFont(15); [_purchaseintentionnumber setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_purchaseintentionnumber]; _purchaseintentionnumber.sd_layout .rightSpaceToView(self.contentView, 15) .centerYEqualToView(_resultscategory) .heightIs(fitScreenWidth(15)); UILabel *purchaseintention = [UILabel new]; purchaseintention.text = @"购买意向:"; purchaseintention.textColor = NewBlackColor; [purchaseintention setSingleLineAutoResizeWithMaxWidth:0]; purchaseintention.font = NewFont(12); [self.contentView addSubview:purchaseintention]; purchaseintention.sd_layout .rightSpaceToView(_purchaseintentionnumber, 1) .centerYEqualToView(_purchaseintentionnumber) .heightIs(fitScreenWidth(12)); _time = [UILabel new]; _time.textColor = [UIColor colorWithString:@"#9A9A9A"]; _time.font = NewFont(10); [_time setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_time]; _time.sd_layout .leftSpaceToView(self.contentView, 15) .bottomSpaceToView(self.contentView, fitScreenWidth(17)) .heightIs(fitScreenWidth(10)); UIImageView *followimge = [UIImageView new]; [followimge setImage:[UIImage imageNamed:@"关注"]]; // followimge.backgroundColor = NewRedColor; [self.contentView addSubview:followimge]; followimge.sd_layout .rightSpaceToView(self.contentView, 15) .centerYEqualToView(_time) .widthIs(fitScreenWidth(16)) .heightIs(fitScreenWidth(16)); _follownumber = [UILabel new]; _follownumber.textColor = [UIColor colorWithString:@"#9A9A9A"]; _follownumber.font = NewFont(11); [_follownumber setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_follownumber]; _follownumber.sd_layout .rightSpaceToView(followimge, 5) .centerYEqualToView(followimge) .heightIs(fitScreenWidth(11)); } return self; } - (void)assignment:(MyneedsModel *)model{ _title.text = model.name; // _negotiatenumber.text = [NSString stringWithFormat:@"%@次",@"11"]; _purchaseintentionnumber.text = [NSString stringWithFormat:@"%@次",model.buyIntention]; _time.text = model.createTimeFormattedDate; if (model.countInterest == NULL) { _follownumber.text = [NSString stringWithFormat:@"关注 %@",@""]; }else{ _follownumber.text = [NSString stringWithFormat:@"关注 %@",model.countInterest]; } //类型(0--专利, 1--软著, 2--项目, 3--版权, 4--工业设计, 5--配方, 6--非标) if ([model.category isEqualToString:@"0"]) { [_resultscategory setTitle:@"专利" forState:UIControlStateNormal]; }else if ([model.category isEqualToString:@"1"]){ [_resultscategory setTitle:@"软著" forState:UIControlStateNormal]; }else if ([model.category isEqualToString:@"2"]){ [_resultscategory setTitle:@"项目" forState:UIControlStateNormal]; }else if ([model.category isEqualToString:@"3"]){ [_resultscategory setTitle:@"版权" forState:UIControlStateNormal]; }else if ([model.category isEqualToString:@"4"]){ [_resultscategory setTitle:@"工业设计" forState:UIControlStateNormal]; }else if ([model.category isEqualToString:@"5"]){ [_resultscategory setTitle:@"配方" forState:UIControlStateNormal]; }else if ([model.category isEqualToString:@"6"]){ [_resultscategory setTitle:@"非标" forState:UIControlStateNormal]; } } - (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