ExpertCollectionViewCell.m 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. //
  2. // ExpertCollectionViewCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/2/6.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "ExpertCollectionViewCell.h"
  9. @implementation ExpertCollectionViewCell
  10. - (id)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. _headimage = [UIImageView new];
  15. _headimage.backgroundColor = NewClearColor;
  16. [self.contentView addSubview:_headimage];
  17. _headimage.sd_layout
  18. .topSpaceToView(self.contentView, 22)
  19. .leftSpaceToView(self.contentView, 15)
  20. .heightIs(64)
  21. .widthIs(64);
  22. ViewRadius(_headimage, 64/2);
  23. _name = [UILabel new];
  24. _name.textColor = NewBlackColor;
  25. _name.font = NewFont(14);
  26. [_name setSingleLineAutoResizeWithMaxWidth:0];
  27. [self.contentView addSubview:_name];
  28. _name.sd_layout
  29. .leftSpaceToView(_headimage, 15)
  30. .topSpaceToView(self.contentView, 15)
  31. .heightIs(13);
  32. _industry = [UILabel new];
  33. _industry.textColor = [UIColor colorWithString:@"#3C3C3C"];
  34. _industry.font = NewFont(11);
  35. [_industry setSingleLineAutoResizeWithMaxWidth:0];
  36. [self.contentView addSubview:_industry];
  37. _industry.sd_layout
  38. .leftSpaceToView(_name, 15)
  39. .bottomEqualToView(_name)
  40. .heightIs(11);
  41. UILabel *line1 = [UILabel new];
  42. line1.backgroundColor = NewLineGrayColor;
  43. [self.contentView addSubview:line1];
  44. line1.sd_layout
  45. .leftEqualToView(_name)
  46. .topSpaceToView(self.contentView, 36)
  47. .heightIs(0.8)
  48. .rightEqualToView(self.contentView);
  49. _briefintroduction = [UILabel new];
  50. _briefintroduction.textColor = [UIColor colorWithString:@"#9A9A9A"];
  51. _briefintroduction.font = NewFont(12);
  52. _briefintroduction.lineBreakMode = NSLineBreakByTruncatingTail;
  53. _briefintroduction.numberOfLines = 2;
  54. [self.contentView addSubview:_briefintroduction];
  55. _briefintroduction.sd_layout
  56. .topSpaceToView(line1, 7)
  57. .leftEqualToView(line1)
  58. .heightIs(35)
  59. .rightSpaceToView(self.contentView, 23);
  60. // _Negotiate = [UILabel new];
  61. // _Negotiate.text = [NSString stringWithFormat:@"%@次洽谈",@"60"];
  62. // _Negotiate.font = NewFont(12);
  63. // _Negotiate.textColor = [UIColor colorWithString:@"#1797E9"];
  64. // [_Negotiate setSingleLineAutoResizeWithMaxWidth:0];
  65. //// [self.contentView addSubview:_Negotiate];
  66. //
  67. // _Negotiate.sd_layout
  68. // .leftEqualToView(line1)
  69. // .bottomSpaceToView(self.contentView, 10)
  70. // .heightIs(12);
  71. _appointment = [UILabel new];
  72. _appointment.font = NewFont(12);
  73. _appointment.textColor = [UIColor colorWithString:@"#FF8523"];
  74. [_appointment setSingleLineAutoResizeWithMaxWidth:0];
  75. [self.contentView addSubview:_appointment];
  76. _appointment.sd_layout
  77. .rightSpaceToView(self.contentView, 15)
  78. .topSpaceToView(self.contentView, 95)
  79. .heightIs(12);
  80. _line3 = [UILabel new];
  81. _line3.backgroundColor = NewLineGrayColor;
  82. [self.contentView addSubview:_line3];
  83. _line3.sd_layout
  84. .leftEqualToView(self.contentView)
  85. .rightEqualToView(self.contentView)
  86. .heightIs(5)
  87. .bottomEqualToView(self.contentView);
  88. _line4 = [UILabel new];
  89. _line4.backgroundColor = NewLineGrayColor;
  90. [self.contentView addSubview:_line4];
  91. _line4.sd_layout
  92. .leftEqualToView(self.contentView)
  93. .heightIs(1)
  94. .rightEqualToView(self.contentView)
  95. .bottomSpaceToView(self.contentView, 44);
  96. _seemoreBT = [UIButton new];
  97. _seemoreBT.backgroundColor = NewWhiteColor;
  98. [self.contentView addSubview:_seemoreBT];
  99. _seemoreBT.sd_layout
  100. .leftEqualToView(self.contentView)
  101. .topSpaceToView(_line4, 0)
  102. .bottomSpaceToView(self.contentView, 1)
  103. .rightEqualToView(self.contentView);
  104. UILabel *gengduo = [UILabel new];
  105. gengduo.text = @"查看更多专家";
  106. gengduo.font = NewFont(12);
  107. gengduo.textColor = [UIColor colorWithString:@"#A1A1A1"];
  108. [gengduo setSingleLineAutoResizeWithMaxWidth:0];
  109. [_seemoreBT addSubview:gengduo];
  110. gengduo.sd_layout
  111. .centerXEqualToView(_seemoreBT)
  112. .topSpaceToView(_seemoreBT, 1)
  113. .bottomSpaceToView(_seemoreBT, 1);
  114. UIImageView *imgeview = [UIImageView new];
  115. [imgeview setImage:[UIImage imageNamed:@"括号"]];
  116. [_seemoreBT addSubview:imgeview];
  117. imgeview.sd_layout
  118. .leftSpaceToView(gengduo, 10)
  119. .heightIs(13)
  120. .widthIs(7)
  121. .centerYEqualToView(_seemoreBT);
  122. }
  123. return self;
  124. }
  125. - (void)assignment:(HomeExpertModel *)model {
  126. [_headimage sd_setImageWithURL:NewURL([model.headPortraitUrl mosaicUrlPrefix]) placeholderImage:[UIImage imageNamed:@"zjtx"]];
  127. _name.text = model.name;
  128. if (model.workUnit == NULL && model.professionalTitle == NULL) {
  129. _industry.text = @"";
  130. }else if(model.workUnit == NULL){
  131. _industry.text = model.professionalTitle;
  132. }else if (model.professionalTitle == NULL){
  133. _industry.text = model.workUnit;
  134. }else{
  135. _industry.text = [NSString stringWithFormat:@"%@%@",model.workUnit,model.professionalTitle];
  136. }
  137. _briefintroduction.text = model.introduction;
  138. _appointment.text = [NSString stringWithFormat:@"%@次预约",model.reservationCount];
  139. }
  140. @end