// // SciencedemandCell.m // jitao // // Created by 罗云飞 on 2017/12/12. // Copyright © 2017年 罗云飞. All rights reserved. // #import "SciencedemandCell.h" @implementation SciencedemandCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { UILabel *line1 = [UILabel new]; line1.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line1]; line1.sd_layout .leftEqualToView(self.contentView) .rightEqualToView(self.contentView) .heightIs(10) .topEqualToView(self.contentView); _image = [UIImageView new]; [_image setImage:[UIImage imageNamed:@"专利类型"]]; _image.backgroundColor = NewClearColor; [self.contentView addSubview:_image]; _image.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(line1, 12) .heightIs(21) .widthIs(48); _demandType = [UILabel new]; _demandType.font = NewFont(10); _demandType.textColor = NewWhiteColor; _demandType.textAlignment = NSTextAlignmentCenter; [_image addSubview:_demandType]; _demandType.sd_layout .leftSpaceToView(_image, 3) .heightIs(21) .rightEqualToView(_image) .topEqualToView(_image); _title = [UILabel new]; _title.font = NewFont(fitScreenWidth(14)); _title.lineBreakMode = NSLineBreakByTruncatingTail; _title.numberOfLines = 1; _title.textColor = [UIColor colorWithString:@"#3C3C3C"]; [self.contentView addSubview:_title]; _title.sd_layout .leftSpaceToView(_image, 15) .rightSpaceToView(self.contentView, 30) .heightIs(14) .centerYEqualToView(_image); UILabel *line = [UILabel new]; line.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line]; line.sd_layout .leftEqualToView(self.contentView) .rightEqualToView(self.contentView) .heightIs(0.8) .topSpaceToView(line1, 44); _content = [UILabel new]; _content.textColor = [UIColor colorWithString:@"#9A9A9A"]; _content.font = NewFont(fitScreenWidth(12)); _content.lineBreakMode = NSLineBreakByTruncatingTail; _content.numberOfLines = 2; [self.contentView addSubview:_content]; _content.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(line, 10) .heightIs(35) .rightSpaceToView(self.contentView, 15); UIImageView *planceimage = [UIImageView new]; [planceimage setImage:[UIImage imageNamed:@"地点"]]; planceimage.backgroundColor = NewClearColor; [self.contentView addSubview:planceimage]; planceimage.sd_layout .leftSpaceToView(self.contentView, 15) .bottomSpaceToView(self.contentView, 10) .heightIs(16) .widthIs(12); _place = [UILabel new]; _place.textColor = [UIColor colorWithString:@"#FF8523"]; _place.font = NewFont(13); [_place setSingleLineAutoResizeWithMaxWidth:80]; [self.contentView addSubview:_place]; _place.sd_layout .leftSpaceToView(planceimage, 5) .centerYEqualToView(planceimage) .heightIs(13); _applyapplication1 = [UILabel new]; _applyapplication1.textColor = NewButtonColor; _applyapplication1.font = NewFont(fitScreenWidth(12)); ViewBorderRadius(_applyapplication1, 3, 1, NewButtonColor); _applyapplication1.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:_applyapplication1]; _applyapplication2 = [UILabel new]; _applyapplication2.textColor = [UIColor colorWithString:@"#FF8523"]; _applyapplication2.font = NewBFont(fitScreenWidth(12)); ViewBorderRadius(_applyapplication2, 3, 1, [UIColor colorWithString:@"#FF8523"]); _applyapplication2.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:_applyapplication2]; _followimage = [UIImageView new]; [_followimage setImage:[UIImage imageNamed:@"关注"]]; [self.contentView addSubview:_followimage]; _followimage.sd_layout .rightSpaceToView(self.contentView, 15) .bottomSpaceToView(self.contentView, 10) .heightIs(16) .widthIs(16); _follownumber = [UILabel new]; _follownumber.textColor = [UIColor colorWithString:@"#9A9A9A"]; _follownumber.font = NewFont(fitScreenWidth(12)); [_follownumber setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_follownumber]; _follownumber.sd_layout .rightSpaceToView(_followimage, 5) .bottomSpaceToView(self.contentView, 10) .heightIs(10); _boutiqueimage = [UIImageView new]; [self.contentView addSubview:_boutiqueimage]; _boutiqueimage.sd_layout .rightEqualToView(self.contentView) .heightIs(34) .widthIs(34) .topSpaceToView(line1, 0); } return self; } - (void)assignment:(Demandmodel *)model { _title.text = model.name; _content.text = model.problemDes; _place.text = model.employerAddress; _follownumber.text = model.countInterest; _applyapplication1.text = model.industryCategory1; if ([model.boutique isEqualToString:@"0"]) { [_boutiqueimage setImage:NewImageNamed(@"")]; }else if([model.boutique isEqualToString:@"1"]){ [_boutiqueimage setImage:NewImageNamed(@"精品")]; } /* demandType=0 技术购买需求 demandType=1 技术设备类需求 demandType=2 技术方案型需求 demandType=3 技术攻关型需求 demandType=4 技术咨询型需求 demandType=5 技术人才型需求 */ if ([model.demandType isEqualToString:@"0"]) { _demandType.text = @"购买需求"; }else if ([model.demandType isEqualToString:@"1"]){ _demandType.text = @"设备需求"; }else if ([model.demandType isEqualToString:@"2"]){ _demandType.text = @"方案需求"; }else if ([model.demandType isEqualToString:@"3"]){ _demandType.text = @"攻关需求"; }else if ([model.demandType isEqualToString:@"4"]){ _demandType.text = @"咨询需求"; }else if ([model.demandType isEqualToString:@"5"]){ _demandType.text = @"人才需求"; } CGFloat width = [NewUtils heightforString:model.industryCategory1 andHeight:18 fontSize:12]; _applyapplication1.sd_layout .leftSpaceToView(self.contentView, fitScreenWidth(115)) .bottomSpaceToView(self.contentView, 10) .heightIs(18) .widthIs(width+15); NSLog(@"加急天数%@",model.urgentDays); NSLog(@"加急报酬%@",model.urgentMoney); CGFloat width1 = 0; if (model.urgentDays == NULL&&model.urgentMoney == NULL) { _applyapplication2.hidden = YES; }else{ if (model.urgentDays != NULL && model.urgentMoney != NULL) { _applyapplication2.hidden = NO; _applyapplication2.text = @"悬赏加急"; width1 = [NewUtils heightforString:@"悬赏加急" andHeight:18 fontSize:12]; }else if (model.urgentDays == NULL && model.urgentMoney != NULL) { _applyapplication2.hidden = NO; _applyapplication2.text = @"悬赏"; width1 = [NewUtils heightforString:@"悬赏" andHeight:18 fontSize:12]; }else{ _applyapplication2.hidden = NO; _applyapplication2.text = @"加急"; width1 = [NewUtils heightforString:@"加急" andHeight:18 fontSize:12]; } } if (model.industryCategory1 == NULL) { _applyapplication1.hidden = YES; _applyapplication2.sd_layout .leftSpaceToView(self.contentView, fitScreenWidth(90)) .bottomSpaceToView(self.contentView, 10) .heightIs(18) .widthIs(width1+15); }else{ _applyapplication2.sd_layout .leftSpaceToView(_applyapplication1, fitScreenWidth(24)) .bottomSpaceToView(self.contentView, 10) .heightIs(18) .widthIs(width1+15); } } - (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