| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- //
- // CollectionCGCell.m
- // jitao
- //
- // Created by 罗云飞 on 2018/8/13.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "CollectionCGCell.h"
- @implementation CollectionCGCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
-
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- _title = [UILabel new];
- _title.font = NewFont(fitScreenWidth(16));
- [_title setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_title];
-
- _title.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .topSpaceToView(self.contentView, 20)
- .heightIs(15);
-
- UILabel *line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line];
-
- line.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .rightSpaceToView(self.contentView, 15)
- .heightIs(0.8)
- .topSpaceToView(_title, 5);
-
- _titledetail = [UILabel new];
- _titledetail.font = NewFont(fitScreenWidth(14));
- _titledetail.textColor = [UIColor colorWithString:@"#6C6C6C"];
- //设置 label的换行模式
- _titledetail.lineBreakMode = NSLineBreakByTruncatingTail; //根据单词进行换行
- //设置label显示几行 可以有无限行
- _titledetail.numberOfLines = 2;
- [self.contentView addSubview:_titledetail];
-
- _titledetail.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .rightSpaceToView(self.contentView, 15)
- .maxHeightIs(40)
- .topSpaceToView(_title, 15);
-
- // for (int i = 0; i<2; i++) {
- _label = [UILabel new];
- _label.textColor = NewButtonColor;
- _label.font = NewFont(fitScreenWidth(13));
- ViewBorderRadius(_label, 3, 1, NewButtonColor);
- _label.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:_label];
- // }
- _label1 = [UILabel new];
- _label1.textColor = NewButtonColor;
- _label1.font = NewFont(fitScreenWidth(13));
-
- ViewBorderRadius(_label1, 3, 1, NewButtonColor);
- _label1.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:_label1];
-
- UILabel *line1 = [UILabel new];
- line1.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line1];
-
- line1.sd_layout
- .bottomEqualToView(self.contentView)
- .heightIs(10)
- .widthIs(SCREEN_WIDTH);
-
- _CollectionBT = [UIButton new];
- _CollectionBT.backgroundColor = NewClearColor;
- [_CollectionBT setImage:NewImageNamed(@"pj") forState:UIControlStateNormal];
- [self.contentView addSubview:_CollectionBT];
-
- _CollectionBT.sd_layout
- .bottomSpaceToView(line1, 15)
- .heightIs(15)
- .widthIs(15)
- .rightSpaceToView(self.contentView, 15);
-
- _CollectionNumber = [UILabel new];
- _CollectionNumber.textColor = [UIColor colorWithString:@"#6C6C6C"];
- _CollectionNumber.font = NewFont(fitScreenWidth(14));
- [_CollectionNumber setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_CollectionNumber];
-
- _CollectionNumber.sd_layout
- .centerYEqualToView(_CollectionBT)
- .heightIs(fitScreenWidth(15))
- .rightSpaceToView(_CollectionBT, 2);
- }
- return self;
- }
- - (void)assignment:(NewshoucangModel *)model type:(NSString *)type{
- _title.text = model.name;
- _titledetail.text = model.introduction;
- _CollectionNumber.text = model.interestCount;
- if (model.fieidA == NULL) {
- CGFloat with = [NewUtils heightforString:@"未知行业" andHeight:20 fontSize:fitScreenWidth(13)];
- _label.frame = CGRectMake(15+(0*(with+16)), 100, with+8, 20);
- _label.text = @"位置行业";
- }else{
- CGFloat with = [NewUtils heightforString:model.fieidA andHeight:20 fontSize:fitScreenWidth(13)];
- _label.frame = CGRectMake(15+(0*(with+16)), 100, with+8, 20);
- _label.text = model.fieidA;
- }
- if ([type isEqualToString:@"成果"]) {
- if ([model.textA isEqualToString:@"0"]) {
- _label1.text = @"正在研发";
- CGFloat with1 = [NewUtils heightforString:@"正在研发" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- }else if ([model.textA isEqualToString:@"1"]){
- _label1.text = @"已有样品";
- CGFloat with1 = [NewUtils heightforString:@"已有样品" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- }else if ([model.textA isEqualToString:@"2"]){
- _label1.text = @"通过小试";
- CGFloat with1 = [NewUtils heightforString:@"通过小试" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- }else if ([model.textA isEqualToString:@"3"]){
- _label1.text = @"通过小试";
- CGFloat with1 = [NewUtils heightforString:@"通过小试" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- }else if ([model.textA isEqualToString:@"4"]){
- _label1.text = @"可以量产";
- CGFloat with1 = [NewUtils heightforString:@"可以量产" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- }else{
- _label1.text = @"未知成熟度";
- CGFloat with1 = [NewUtils heightforString:@"未知成熟度" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- }
- }else if ([type isEqualToString:@"需求"]){
- if ([model.textA isEqualToString:@"1"]) {
- _label1.text = @"加急";
- _label1.textColor = NewOrangeColor;
- CGFloat with1 = [NewUtils heightforString:@"加急" andHeight:20 fontSize:fitScreenWidth(13)];
- _label1.frame = CGRectMake(_label.frame.size.width+15+10, 100, with1+8, 20);
- ViewBorderRadius(_label1, 0, 0, NewClearColor);
- }else{
-
- }
- }
-
- }
- - (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
|