JSZJlistCell.m 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //
  2. // JSZJlistCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/8/17.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "JSZJlistCell.h"
  9. @implementation JSZJlistCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. UILabel *line = [UILabel new];
  14. line.backgroundColor = NewLineGrayColor;
  15. [self.contentView addSubview:line];
  16. line.sd_layout
  17. .leftEqualToView(self.contentView)
  18. .heightIs(10)
  19. .rightEqualToView(self.contentView)
  20. .topEqualToView(self.contentView);
  21. _headimage = [UIImageView new];
  22. ViewRadius(_headimage, 40);
  23. [self.contentView addSubview:_headimage];
  24. _headimage.sd_layout
  25. .leftSpaceToView(self.contentView, 15)
  26. .heightIs(80)
  27. .widthIs(80)
  28. .topSpaceToView(line, 30);
  29. _name = [UILabel new];
  30. _name.font = NewFont(fitScreenWidth(15));
  31. [_name setSingleLineAutoResizeWithMaxWidth:0];
  32. _name.textAlignment = NSTextAlignmentLeft;
  33. [self.contentView addSubview:_name];
  34. _name.sd_layout
  35. .leftSpaceToView(_headimage, 15)
  36. .heightIs(15)
  37. .topSpaceToView(line, 35);
  38. _ZJtitile = [UILabel new];
  39. _ZJtitile.font = NewFont(fitScreenWidth(13));
  40. _ZJtitile.textColor = NewButtonColor;
  41. // [_ZJtitile setSingleLineAutoResizeWithMaxWidth:0];
  42. _ZJtitile.textAlignment = NSTextAlignmentLeft;
  43. [self.contentView addSubview:_ZJtitile];
  44. _ZJtitile.sd_layout
  45. .rightSpaceToView(self.contentView, 15)
  46. .heightIs(15)
  47. .topSpaceToView(line, 35)
  48. .leftSpaceToView(_name, 30);
  49. UILabel *line1 = [UILabel new];
  50. line1.backgroundColor = NewLineGrayColor;
  51. [self.contentView addSubview:line1];
  52. line1.sd_layout
  53. .leftEqualToView(_name)
  54. .heightIs(0.8)
  55. .rightSpaceToView(self.contentView, 15)
  56. .topSpaceToView(_name, 8);
  57. _neirong = [UILabel new];
  58. _neirong.font = NewFont(fitScreenWidth(14));
  59. _neirong.numberOfLines = 2;
  60. _neirong.lineBreakMode = NSLineBreakByTruncatingTail;
  61. _neirong.textColor = [UIColor colorWithString:@"#6C6C6C"];
  62. [self.contentView addSubview:_neirong];
  63. _neirong.sd_layout
  64. .leftEqualToView(line1)
  65. .maxHeightIs(35)
  66. .rightSpaceToView(self.contentView, 15)
  67. .topSpaceToView(line1, 10);
  68. _HPLtitle = [UILabel new];
  69. _HPLtitle.textColor = [UIColor colorWithString:@"#FF9350"];
  70. _HPLtitle.font = NewFont(fitScreenWidth(12));
  71. [_HPLtitle setSingleLineAutoResizeWithMaxWidth:0];
  72. [self.contentView addSubview:_HPLtitle];
  73. _HPLtitle.sd_layout
  74. .leftEqualToView(_name)
  75. .heightIs(12)
  76. .bottomSpaceToView(self.contentView, 15);
  77. _guanzhu = [UIButton new];
  78. // [_guanzhu setBackgroundColor:NewRedColor];
  79. [_guanzhu setBackgroundImage:NewImageNamed(@"pj") forState:UIControlStateNormal];
  80. [self.contentView addSubview:_guanzhu];
  81. _guanzhu.sd_layout
  82. .rightSpaceToView(self.contentView, 15)
  83. .heightIs(15)
  84. .widthIs(15)
  85. .centerYEqualToView(_HPLtitle);
  86. _guanzhuNumber = [UILabel new];
  87. _guanzhuNumber.textColor = [UIColor colorWithString:@"#AEAEAE"];
  88. _guanzhuNumber.font = NewFont(13);
  89. [_guanzhuNumber setSingleLineAutoResizeWithMaxWidth:0];
  90. [self.contentView addSubview:_guanzhuNumber];
  91. _guanzhuNumber.sd_layout
  92. .rightSpaceToView(_guanzhu, 5)
  93. .heightIs(15)
  94. .centerYEqualToView(_HPLtitle);
  95. }
  96. return self;
  97. }
  98. - (void)assignment:(ZJlistModel *)model {
  99. [_headimage sd_setImageWithURL:NewURL([model.personPortraitUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"专家-6")];
  100. _name.text = model.username;
  101. _neirong.text = model.introduction;
  102. _HPLtitle.text = [NSString stringWithFormat:@"好评率:%@",model.favorableRate];
  103. _guanzhuNumber.text = model.countInterest;
  104. _ZJtitile.text = [NSString stringWithFormat:@"%@ %@",model.workUnit,model.professionalTitle];
  105. }
  106. - (void)awakeFromNib {
  107. [super awakeFromNib];
  108. // Initialization code
  109. }
  110. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  111. [super setSelected:selected animated:animated];
  112. // Configure the view for the selected state
  113. }
  114. @end