MyresultsCell.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. //
  2. // MyresultsCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/8.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "MyresultsCell.h"
  9. @implementation MyresultsCell
  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 = NewNavigationColor;
  15. [self.contentView addSubview:line];
  16. line.sd_layout
  17. .leftEqualToView(self.contentView)
  18. .topEqualToView(self.contentView)
  19. .rightEqualToView(self.contentView)
  20. .heightIs(10);
  21. _title = [UILabel new];
  22. _title.font = NewFont(14);
  23. _title.textColor = [UIColor colorWithString:@"#3C3C3C"];
  24. //设置 label的换行模式
  25. _title.lineBreakMode = NSLineBreakByTruncatingTail; //根据单词进行换行
  26. //设置label显示几行 可以有无限行
  27. _title.numberOfLines = 1;
  28. [self.contentView addSubview:_title];
  29. _title.sd_layout
  30. .leftSpaceToView(self.contentView, 15)
  31. .rightSpaceToView(self.contentView, 15)
  32. .topSpaceToView(line, 0)
  33. .heightIs(fitScreenWidth(44));
  34. UILabel *line1 = [UILabel new];
  35. line1.backgroundColor = NewLineGrayColor;
  36. [self.contentView addSubview:line1];
  37. line1.sd_layout
  38. .leftEqualToView(self.contentView)
  39. .topSpaceToView(_title, 1)
  40. .rightEqualToView(self.contentView)
  41. .heightIs(0.8);
  42. _resultscategory = [UIButton new];
  43. [_resultscategory setTitleColor:NewButtonColor forState:UIControlStateNormal];
  44. _resultscategory.titleLabel.font = NewFont(12);
  45. ViewBorderRadius(_resultscategory, 3, 1, NewButtonColor);
  46. [self.contentView addSubview:_resultscategory];
  47. _resultscategory.sd_layout
  48. .leftSpaceToView(self.contentView, 15)
  49. .topSpaceToView(line1, 15)
  50. .heightIs(fitScreenWidth(26))
  51. .widthIs(fitScreenWidth(100));
  52. // UILabel *negotiate = [UILabel new];
  53. // negotiate.text = @"洽谈:";
  54. // negotiate.font = NewFont(12);
  55. // negotiate.textColor = NewBlackColor;
  56. // [negotiate setSingleLineAutoResizeWithMaxWidth:0];
  57. // [self.contentView addSubview:negotiate];
  58. //
  59. // negotiate.sd_layout
  60. // .centerYEqualToView(_resultscategory)
  61. // .rightSpaceToView(self.contentView, SCREEN_WIDTH/2)
  62. // .heightIs(fitScreenWidth(12));
  63. //
  64. // _negotiatenumber = [UILabel new];
  65. // _negotiatenumber.textColor = [UIColor colorWithString:@"#F46A6A"];
  66. // _negotiatenumber.font = NewBFont(15);
  67. // [_negotiatenumber setSingleLineAutoResizeWithMaxWidth:0];
  68. // [self.contentView addSubview:_negotiatenumber];
  69. //
  70. // _negotiatenumber.sd_layout
  71. // .leftSpaceToView(self.contentView, SCREEN_WIDTH/2)
  72. // .centerYEqualToView(negotiate)
  73. // .heightIs(fitScreenWidth(15));
  74. _purchaseintentionnumber = [UILabel new];
  75. _purchaseintentionnumber.textColor = [UIColor colorWithString:@"#F46A6A"];
  76. _purchaseintentionnumber.font = NewBFont(15);
  77. [_purchaseintentionnumber setSingleLineAutoResizeWithMaxWidth:0];
  78. [self.contentView addSubview:_purchaseintentionnumber];
  79. _purchaseintentionnumber.sd_layout
  80. .rightSpaceToView(self.contentView, 15)
  81. .centerYEqualToView(_resultscategory)
  82. .heightIs(fitScreenWidth(15));
  83. UILabel *purchaseintention = [UILabel new];
  84. purchaseintention.text = @"购买意向:";
  85. purchaseintention.textColor = NewBlackColor;
  86. [purchaseintention setSingleLineAutoResizeWithMaxWidth:0];
  87. purchaseintention.font = NewFont(12);
  88. [self.contentView addSubview:purchaseintention];
  89. purchaseintention.sd_layout
  90. .rightSpaceToView(_purchaseintentionnumber, 1)
  91. .centerYEqualToView(_purchaseintentionnumber)
  92. .heightIs(fitScreenWidth(12));
  93. _time = [UILabel new];
  94. _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
  95. _time.font = NewFont(10);
  96. [_time setSingleLineAutoResizeWithMaxWidth:0];
  97. [self.contentView addSubview:_time];
  98. _time.sd_layout
  99. .leftSpaceToView(self.contentView, 15)
  100. .bottomSpaceToView(self.contentView, fitScreenWidth(17))
  101. .heightIs(fitScreenWidth(10));
  102. UIImageView *followimge = [UIImageView new];
  103. [followimge setImage:[UIImage imageNamed:@"关注"]];
  104. // followimge.backgroundColor = NewRedColor;
  105. [self.contentView addSubview:followimge];
  106. followimge.sd_layout
  107. .rightSpaceToView(self.contentView, 15)
  108. .centerYEqualToView(_time)
  109. .widthIs(fitScreenWidth(16))
  110. .heightIs(fitScreenWidth(16));
  111. _follownumber = [UILabel new];
  112. _follownumber.textColor = [UIColor colorWithString:@"#9A9A9A"];
  113. _follownumber.font = NewFont(11);
  114. [_follownumber setSingleLineAutoResizeWithMaxWidth:0];
  115. [self.contentView addSubview:_follownumber];
  116. _follownumber.sd_layout
  117. .rightSpaceToView(followimge, 5)
  118. .centerYEqualToView(followimge)
  119. .heightIs(fitScreenWidth(11));
  120. }
  121. return self;
  122. }
  123. - (void)assignment:(MyneedsModel *)model{
  124. _title.text = model.name;
  125. // _negotiatenumber.text = [NSString stringWithFormat:@"%@次",@"11"];
  126. _purchaseintentionnumber.text = [NSString stringWithFormat:@"%@次",model.buyIntention];
  127. _time.text = model.createTimeFormattedDate;
  128. if (model.countInterest == NULL) {
  129. _follownumber.text = [NSString stringWithFormat:@"关注 %@",@""];
  130. }else{
  131. _follownumber.text = [NSString stringWithFormat:@"关注 %@",model.countInterest];
  132. }
  133. //类型(0--专利, 1--软著, 2--项目, 3--版权, 4--工业设计, 5--配方, 6--非标)
  134. if ([model.category isEqualToString:@"0"]) {
  135. [_resultscategory setTitle:@"专利" forState:UIControlStateNormal];
  136. }else if ([model.category isEqualToString:@"1"]){
  137. [_resultscategory setTitle:@"软著" forState:UIControlStateNormal];
  138. }else if ([model.category isEqualToString:@"2"]){
  139. [_resultscategory setTitle:@"项目" forState:UIControlStateNormal];
  140. }else if ([model.category isEqualToString:@"3"]){
  141. [_resultscategory setTitle:@"版权" forState:UIControlStateNormal];
  142. }else if ([model.category isEqualToString:@"4"]){
  143. [_resultscategory setTitle:@"工业设计" forState:UIControlStateNormal];
  144. }else if ([model.category isEqualToString:@"5"]){
  145. [_resultscategory setTitle:@"配方" forState:UIControlStateNormal];
  146. }else if ([model.category isEqualToString:@"6"]){
  147. [_resultscategory setTitle:@"非标" forState:UIControlStateNormal];
  148. }
  149. }
  150. - (void)awakeFromNib {
  151. [super awakeFromNib];
  152. // Initialization code
  153. }
  154. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  155. [super setSelected:selected animated:animated];
  156. // Configure the view for the selected state
  157. }
  158. @end