NewMyxuqiuCell.m 3.1 KB

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