| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // NewMyneedsCell.m
- // jitao
- //
- // Created by 罗云飞 on 2018/8/11.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "NewMyneedsCell.h"
- @implementation NewMyneedsCell
- /*
- @property(copy,nonatomic)UILabel *title;
- @property(copy,nonatomic)UILabel *time;
- @property(copy,nonatomic)UILabel *Collectionnumber;
- @property(copy,nonatomic)UIButton *fowllerbT;
- */
- - (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];
- // [_fowllerbT setImage:NewImageNamed(@"pj") forState:UIControlStateNormal];
- [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:(NewAchievementsModel *)model {
- _title.text = model.name;
- _time.text = [NSString stringWithFormat:@"更新时间:%@",[NewUtils shijian:model.createTime]];
- _Collectionnumber.text = [NSString stringWithFormat:@"%@次收藏",model.interestCount];
- if ([model.ifInterest 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
|