| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- //
- // NewMyxuqiuCell.m
- // jitao
- //
- // Created by 罗云飞 on 2018/8/27.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "NewMyxuqiuCell.h"
- @implementation NewMyxuqiuCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
-
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- _title = [UILabel new];
- _title.font = NewFont(fitScreenWidth(16));
- //设置 label的换行模式
- _title.lineBreakMode = NSLineBreakByTruncatingTail; //根据单词进行换行
- //设置label显示几行 可以有无限行
- _title.numberOfLines = 2;
- [self.contentView addSubview:_title];
-
- _title.sd_layout
- .leftSpaceToView(self.contentView, 15)
- .maxHeightIs(40)
- .topSpaceToView(self.contentView, 20)
- .rightSpaceToView(self.contentView, 40);
-
- _time = [UILabel new];
- _time.font = NewFont(fitScreenWidth(13));
- _time.textColor = [UIColor colorWithString:@"#AEAEAE"];
- [_time setSingleLineAutoResizeWithMaxWidth:0];
- [self.contentView addSubview:_time];
-
- _time.sd_layout
- .leftEqualToView(_title)
- .bottomSpaceToView(self.contentView, 30)
- .heightIs(15);
-
- _Collectionnumber = [UILabel new];
- [_Collectionnumber setSingleLineAutoResizeWithMaxWidth:0];
- _Collectionnumber.font = NewFont(fitScreenWidth(13));
- _Collectionnumber.textColor = [UIColor colorWithString:@"#AEAEAE"];
- [self.contentView addSubview:_Collectionnumber];
-
- _Collectionnumber.sd_layout
- .centerYEqualToView(_time)
- .heightIs(15)
- .rightSpaceToView(self.contentView, 40);
-
- _fowllerbT = [UIButton new];
- [self.contentView addSubview:_fowllerbT];
-
- _fowllerbT.sd_layout
- .centerYEqualToView(_Collectionnumber)
- .heightIs(15)
- .widthIs(15)
- .rightSpaceToView(self.contentView, 15);
-
- UILabel *line = [UILabel new];
- line.backgroundColor = NewLineGrayColor;
- [self.contentView addSubview:line];
-
- line.sd_layout
- .bottomEqualToView(self.contentView)
- .heightIs(10)
- .widthIs(SCREEN_WIDTH);
-
- }
- return self;
- }
- - (void)assignment:(NewMyneedsViewModel *)model {
- _title.text = model.name;
- _time.text = [NSString stringWithFormat:@"更新时间:%@",[NewUtils shijian:model.createTime]];
- _Collectionnumber.text = [NSString stringWithFormat:@"%@次收藏",model.interestCount];
- if ([model.interest isEqualToString:@"0"]) {//否
- [_fowllerbT setImage:NewImageNamed(@"wpj") forState:UIControlStateNormal];
- }else{//是
- [_fowllerbT setImage:NewImageNamed(@"pj") 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
|