NewMyneedsCell.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // NewMyneedsCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/8/11.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "NewMyneedsCell.h"
  9. @implementation NewMyneedsCell
  10. /*
  11. @property(copy,nonatomic)UILabel *title;
  12. @property(copy,nonatomic)UILabel *time;
  13. @property(copy,nonatomic)UILabel *Collectionnumber;
  14. @property(copy,nonatomic)UIButton *fowllerbT;
  15. */
  16. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  17. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  18. if (self) {
  19. _title = [UILabel new];
  20. _title.font = NewFont(fitScreenWidth(16));
  21. //设置 label的换行模式
  22. _title.lineBreakMode = NSLineBreakByTruncatingTail; //根据单词进行换行
  23. //设置label显示几行 可以有无限行
  24. _title.numberOfLines = 2;
  25. [self.contentView addSubview:_title];
  26. _title.sd_layout
  27. .leftSpaceToView(self.contentView, 15)
  28. .maxHeightIs(40)
  29. .topSpaceToView(self.contentView, 20)
  30. .rightSpaceToView(self.contentView, 40);
  31. _time = [UILabel new];
  32. _time.font = NewFont(fitScreenWidth(13));
  33. _time.textColor = [UIColor colorWithString:@"#AEAEAE"];
  34. [_time setSingleLineAutoResizeWithMaxWidth:0];
  35. [self.contentView addSubview:_time];
  36. _time.sd_layout
  37. .leftEqualToView(_title)
  38. .bottomSpaceToView(self.contentView, 30)
  39. .heightIs(15);
  40. _Collectionnumber = [UILabel new];
  41. [_Collectionnumber setSingleLineAutoResizeWithMaxWidth:0];
  42. _Collectionnumber.font = NewFont(fitScreenWidth(13));
  43. _Collectionnumber.textColor = [UIColor colorWithString:@"#AEAEAE"];
  44. [self.contentView addSubview:_Collectionnumber];
  45. _Collectionnumber.sd_layout
  46. .centerYEqualToView(_time)
  47. .heightIs(15)
  48. .rightSpaceToView(self.contentView, 40);
  49. _fowllerbT = [UIButton new];
  50. // [_fowllerbT setImage:NewImageNamed(@"pj") forState:UIControlStateNormal];
  51. [self.contentView addSubview:_fowllerbT];
  52. _fowllerbT.sd_layout
  53. .centerYEqualToView(_Collectionnumber)
  54. .heightIs(15)
  55. .widthIs(15)
  56. .rightSpaceToView(self.contentView, 15);
  57. UILabel *line = [UILabel new];
  58. line.backgroundColor = NewLineGrayColor;
  59. [self.contentView addSubview:line];
  60. line.sd_layout
  61. .bottomEqualToView(self.contentView)
  62. .heightIs(10)
  63. .widthIs(SCREEN_WIDTH);
  64. }
  65. return self;
  66. }
  67. - (void)assignment:(NewAchievementsModel *)model {
  68. _title.text = model.name;
  69. _time.text = [NSString stringWithFormat:@"更新时间:%@",[NewUtils shijian:model.createTime]];
  70. _Collectionnumber.text = [NSString stringWithFormat:@"%@次收藏",model.interestCount];
  71. if ([model.ifInterest isEqualToString:@"0"]) {//否
  72. [_fowllerbT setImage:NewImageNamed(@"wpj") forState:UIControlStateNormal];
  73. }else{//是
  74. [_fowllerbT setImage:NewImageNamed(@"pj") forState:UIControlStateNormal];
  75. }
  76. }
  77. - (void)awakeFromNib {
  78. [super awakeFromNib];
  79. // Initialization code
  80. }
  81. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  82. [super setSelected:selected animated:animated];
  83. // Configure the view for the selected state
  84. }
  85. @end