// // MyneedsCell.m // jitao // // Created by 罗云飞 on 2017/12/8. // Copyright © 2017年 罗云飞. All rights reserved. // #import "MyneedsCell.h" @implementation MyneedsCell - (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:[UIColor colorWithString:@"#FF8523"] forState:UIControlStateNormal]; _resultscategory.titleLabel.font = NewFont(12); ViewBorderRadius(_resultscategory, 3, 1, [UIColor colorWithString:@"#FF8523"]); [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)); _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:@"关注"]]; [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:@"%@次",model.orderCount]; _time.text = model.createTimeFormattedDate; if (model.countInterest == NULL) { _follownumber.text = [NSString stringWithFormat:@"关注 %@",@""]; }else{ _follownumber.text = [NSString stringWithFormat:@"关注 %@",model.countInterest]; } // 我的需求 audit_status 审核状态(0--未提交审核草稿,1,--提交审核,2--审核中,3--审核通过,4--审核未通过) //0-未提交审核 1-审核中 2-审核通过 3审核未通过 if ([model.auditStatus isEqualToString:@"0"]) { [_resultscategory setTitle:@"未提交审核" forState:UIControlStateNormal]; }else if ([model.auditStatus isEqualToString:@"1"]){ [_resultscategory setTitle:@"提交审核中" forState:UIControlStateNormal]; }else if ([model.auditStatus isEqualToString:@"2"]){ [_resultscategory setTitle:@"审核中" forState:UIControlStateNormal]; }else if ([model.auditStatus isEqualToString:@"3"]){ [_resultscategory setTitle:@"审核通过" forState:UIControlStateNormal]; }else if ([model.auditStatus isEqualToString:@"4"]){ [_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