GuWenCell.m 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // GuWenCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/8/19.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "GuWenCell.h"
  9. @implementation GuWenCell
  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(15);
  31. [_name setSingleLineAutoResizeWithMaxWidth:0];
  32. [self.contentView addSubview:_name];
  33. _name.sd_layout
  34. .leftSpaceToView(_headimage, 15)
  35. .heightIs(15)
  36. .topSpaceToView(line, 35);
  37. _ZJtitile = [UILabel new];
  38. _ZJtitile.font = NewFont(13);
  39. _ZJtitile.textColor = NewButtonColor;
  40. [_ZJtitile setSingleLineAutoResizeWithMaxWidth:0];
  41. [self.contentView addSubview:_ZJtitile];
  42. _ZJtitile.sd_layout
  43. .rightSpaceToView(self.contentView, 15)
  44. .heightIs(15)
  45. .topSpaceToView(line, 35);
  46. UILabel *line1 = [UILabel new];
  47. line1.backgroundColor = NewLineGrayColor;
  48. [self.contentView addSubview:line1];
  49. line1.sd_layout
  50. .leftEqualToView(_name)
  51. .heightIs(0.8)
  52. .rightSpaceToView(self.contentView, 15)
  53. .topSpaceToView(_name, 8);
  54. _neirong = [UILabel new];
  55. _neirong.font = NewFont(14);
  56. _neirong.numberOfLines = 2;
  57. _neirong.lineBreakMode = NSLineBreakByTruncatingTail;
  58. _neirong.textColor = [UIColor colorWithString:@"#6C6C6C"];
  59. [self.contentView addSubview:_neirong];
  60. _neirong.sd_layout
  61. .leftEqualToView(line1)
  62. .maxHeightIs(35)
  63. .rightSpaceToView(self.contentView, 15)
  64. .topSpaceToView(line1, 10);
  65. _HPLtitle = [UILabel new];
  66. _HPLtitle.textColor = [UIColor colorWithString:@"#FF9350"];
  67. _HPLtitle.font = NewFont(12);
  68. [_HPLtitle setSingleLineAutoResizeWithMaxWidth:0];
  69. [self.contentView addSubview:_HPLtitle];
  70. _HPLtitle.sd_layout
  71. .leftEqualToView(_name)
  72. .heightIs(12)
  73. .bottomSpaceToView(self.contentView, 15);
  74. _guanzhu = [UIButton new];
  75. [_guanzhu setBackgroundImage:NewImageNamed(@"pj") forState:UIControlStateNormal];
  76. [self.contentView addSubview:_guanzhu];
  77. _guanzhu.sd_layout
  78. .rightSpaceToView(self.contentView, 15)
  79. .heightIs(15)
  80. .widthIs(15)
  81. .centerYEqualToView(_HPLtitle);
  82. _guanzhuNumber = [UILabel new];
  83. _guanzhuNumber.textColor = [UIColor colorWithString:@"#AEAEAE"];
  84. _guanzhuNumber.font = NewFont(13);
  85. [_guanzhuNumber setSingleLineAutoResizeWithMaxWidth:0];
  86. [self.contentView addSubview:_guanzhuNumber];
  87. _guanzhuNumber.sd_layout
  88. .rightSpaceToView(_guanzhu, 5)
  89. .heightIs(15)
  90. .centerYEqualToView(_HPLtitle);
  91. }
  92. return self;
  93. }
  94. - (void)assignment:(GUWenlistModel *)model{
  95. [_headimage sd_setImageWithURL:NewURL([model.personPortraitUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"顾问-6")];
  96. _name.text = model.username;
  97. //顾问类型 0 专利代理人 1 专利顾问 2 版权顾问 3 商标顾问
  98. if ([model.consultantType isEqualToString:@"0"]) {
  99. _ZJtitile.text = @"专利代理人";
  100. }else if ([model.consultantType isEqualToString:@"1"]) {
  101. _ZJtitile.text = @"专利顾问";
  102. }else if ([model.consultantType isEqualToString:@"2"]) {
  103. _ZJtitile.text = @"版权顾问";
  104. }else if ([model.consultantType isEqualToString:@"3"]) {
  105. _ZJtitile.text = @"商标顾问";
  106. }
  107. _neirong.text = model.introduction;
  108. _HPLtitle.text = [NSString stringWithFormat:@"好评率:%@",model.favorableRate];
  109. _guanzhuNumber.text = model.countInterest;
  110. }
  111. - (void)awakeFromNib {
  112. [super awakeFromNib];
  113. // Initialization code
  114. }
  115. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  116. [super setSelected:selected animated:animated];
  117. // Configure the view for the selected state
  118. }
  119. @end