SciencedemandCell.m 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. //
  2. // SciencedemandCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/12.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "SciencedemandCell.h"
  9. @implementation SciencedemandCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. UILabel *line1 = [UILabel new];
  14. line1.backgroundColor = NewLineGrayColor;
  15. [self.contentView addSubview:line1];
  16. line1.sd_layout
  17. .leftEqualToView(self.contentView)
  18. .rightEqualToView(self.contentView)
  19. .heightIs(10)
  20. .topEqualToView(self.contentView);
  21. _image = [UIImageView new];
  22. [_image setImage:[UIImage imageNamed:@"专利类型"]];
  23. _image.backgroundColor = NewClearColor;
  24. [self.contentView addSubview:_image];
  25. _image.sd_layout
  26. .leftSpaceToView(self.contentView, 15)
  27. .topSpaceToView(line1, 12)
  28. .heightIs(21)
  29. .widthIs(48);
  30. _demandType = [UILabel new];
  31. _demandType.font = NewFont(10);
  32. _demandType.textColor = NewWhiteColor;
  33. _demandType.textAlignment = NSTextAlignmentCenter;
  34. [_image addSubview:_demandType];
  35. _demandType.sd_layout
  36. .leftSpaceToView(_image, 3)
  37. .heightIs(21)
  38. .rightEqualToView(_image)
  39. .topEqualToView(_image);
  40. _title = [UILabel new];
  41. _title.font = NewFont(fitScreenWidth(14));
  42. _title.lineBreakMode = NSLineBreakByTruncatingTail;
  43. _title.numberOfLines = 1;
  44. _title.textColor = [UIColor colorWithString:@"#3C3C3C"];
  45. [self.contentView addSubview:_title];
  46. _title.sd_layout
  47. .leftSpaceToView(_image, 15)
  48. .rightSpaceToView(self.contentView, 30)
  49. .heightIs(14)
  50. .centerYEqualToView(_image);
  51. UILabel *line = [UILabel new];
  52. line.backgroundColor = NewLineGrayColor;
  53. [self.contentView addSubview:line];
  54. line.sd_layout
  55. .leftEqualToView(self.contentView)
  56. .rightEqualToView(self.contentView)
  57. .heightIs(0.8)
  58. .topSpaceToView(line1, 44);
  59. _content = [UILabel new];
  60. _content.textColor = [UIColor colorWithString:@"#9A9A9A"];
  61. _content.font = NewFont(fitScreenWidth(12));
  62. _content.lineBreakMode = NSLineBreakByTruncatingTail;
  63. _content.numberOfLines = 2;
  64. [self.contentView addSubview:_content];
  65. _content.sd_layout
  66. .leftSpaceToView(self.contentView, 15)
  67. .topSpaceToView(line, 10)
  68. .heightIs(35)
  69. .rightSpaceToView(self.contentView, 15);
  70. UIImageView *planceimage = [UIImageView new];
  71. [planceimage setImage:[UIImage imageNamed:@"地点"]];
  72. planceimage.backgroundColor = NewClearColor;
  73. [self.contentView addSubview:planceimage];
  74. planceimage.sd_layout
  75. .leftSpaceToView(self.contentView, 15)
  76. .bottomSpaceToView(self.contentView, 10)
  77. .heightIs(16)
  78. .widthIs(12);
  79. _place = [UILabel new];
  80. _place.textColor = [UIColor colorWithString:@"#FF8523"];
  81. _place.font = NewFont(13);
  82. [_place setSingleLineAutoResizeWithMaxWidth:80];
  83. [self.contentView addSubview:_place];
  84. _place.sd_layout
  85. .leftSpaceToView(planceimage, 5)
  86. .centerYEqualToView(planceimage)
  87. .heightIs(13);
  88. _applyapplication1 = [UILabel new];
  89. _applyapplication1.textColor = NewButtonColor;
  90. _applyapplication1.font = NewFont(fitScreenWidth(12));
  91. ViewBorderRadius(_applyapplication1, 3, 1, NewButtonColor);
  92. _applyapplication1.textAlignment = NSTextAlignmentCenter;
  93. [self.contentView addSubview:_applyapplication1];
  94. _applyapplication2 = [UILabel new];
  95. _applyapplication2.textColor = [UIColor colorWithString:@"#FF8523"];
  96. _applyapplication2.font = NewBFont(fitScreenWidth(12));
  97. ViewBorderRadius(_applyapplication2, 3, 1, [UIColor colorWithString:@"#FF8523"]);
  98. _applyapplication2.textAlignment = NSTextAlignmentCenter;
  99. [self.contentView addSubview:_applyapplication2];
  100. _followimage = [UIImageView new];
  101. [_followimage setImage:[UIImage imageNamed:@"关注"]];
  102. [self.contentView addSubview:_followimage];
  103. _followimage.sd_layout
  104. .rightSpaceToView(self.contentView, 15)
  105. .bottomSpaceToView(self.contentView, 10)
  106. .heightIs(16)
  107. .widthIs(16);
  108. _follownumber = [UILabel new];
  109. _follownumber.textColor = [UIColor colorWithString:@"#9A9A9A"];
  110. _follownumber.font = NewFont(fitScreenWidth(12));
  111. [_follownumber setSingleLineAutoResizeWithMaxWidth:0];
  112. [self.contentView addSubview:_follownumber];
  113. _follownumber.sd_layout
  114. .rightSpaceToView(_followimage, 5)
  115. .bottomSpaceToView(self.contentView, 10)
  116. .heightIs(10);
  117. _boutiqueimage = [UIImageView new];
  118. [self.contentView addSubview:_boutiqueimage];
  119. _boutiqueimage.sd_layout
  120. .rightEqualToView(self.contentView)
  121. .heightIs(34)
  122. .widthIs(34)
  123. .topSpaceToView(line1, 0);
  124. }
  125. return self;
  126. }
  127. - (void)assignment:(Demandmodel *)model {
  128. _title.text = model.name;
  129. _content.text = model.problemDes;
  130. _place.text = model.employerAddress;
  131. _follownumber.text = model.countInterest;
  132. _applyapplication1.text = model.industryCategory1;
  133. if ([model.boutique isEqualToString:@"0"]) {
  134. [_boutiqueimage setImage:NewImageNamed(@"")];
  135. }else if([model.boutique isEqualToString:@"1"]){
  136. [_boutiqueimage setImage:NewImageNamed(@"精品")];
  137. }
  138. /*
  139. demandType=0 技术购买需求
  140. demandType=1 技术设备类需求
  141. demandType=2 技术方案型需求
  142. demandType=3 技术攻关型需求
  143. demandType=4 技术咨询型需求
  144. demandType=5 技术人才型需求
  145. */
  146. if ([model.demandType isEqualToString:@"0"]) {
  147. _demandType.text = @"购买需求";
  148. }else if ([model.demandType isEqualToString:@"1"]){
  149. _demandType.text = @"设备需求";
  150. }else if ([model.demandType isEqualToString:@"2"]){
  151. _demandType.text = @"方案需求";
  152. }else if ([model.demandType isEqualToString:@"3"]){
  153. _demandType.text = @"攻关需求";
  154. }else if ([model.demandType isEqualToString:@"4"]){
  155. _demandType.text = @"咨询需求";
  156. }else if ([model.demandType isEqualToString:@"5"]){
  157. _demandType.text = @"人才需求";
  158. }
  159. CGFloat width = [NewUtils heightforString:model.industryCategory1 andHeight:18 fontSize:12];
  160. _applyapplication1.sd_layout
  161. .leftSpaceToView(self.contentView, fitScreenWidth(115))
  162. .bottomSpaceToView(self.contentView, 10)
  163. .heightIs(18)
  164. .widthIs(width+15);
  165. NSLog(@"加急天数%@",model.urgentDays);
  166. NSLog(@"加急报酬%@",model.urgentMoney);
  167. CGFloat width1 = 0;
  168. if (model.urgentDays == NULL&&model.urgentMoney == NULL) {
  169. _applyapplication2.hidden = YES;
  170. }else{
  171. if (model.urgentDays != NULL && model.urgentMoney != NULL) {
  172. _applyapplication2.hidden = NO;
  173. _applyapplication2.text = @"悬赏加急";
  174. width1 = [NewUtils heightforString:@"悬赏加急" andHeight:18 fontSize:12];
  175. }else if (model.urgentDays == NULL && model.urgentMoney != NULL) {
  176. _applyapplication2.hidden = NO;
  177. _applyapplication2.text = @"悬赏";
  178. width1 = [NewUtils heightforString:@"悬赏" andHeight:18 fontSize:12];
  179. }else{
  180. _applyapplication2.hidden = NO;
  181. _applyapplication2.text = @"加急";
  182. width1 = [NewUtils heightforString:@"加急" andHeight:18 fontSize:12];
  183. }
  184. }
  185. if (model.industryCategory1 == NULL) {
  186. _applyapplication1.hidden = YES;
  187. _applyapplication2.sd_layout
  188. .leftSpaceToView(self.contentView, fitScreenWidth(90))
  189. .bottomSpaceToView(self.contentView, 10)
  190. .heightIs(18)
  191. .widthIs(width1+15);
  192. }else{
  193. _applyapplication2.sd_layout
  194. .leftSpaceToView(_applyapplication1, fitScreenWidth(24))
  195. .bottomSpaceToView(self.contentView, 10)
  196. .heightIs(18)
  197. .widthIs(width1+15);
  198. }
  199. }
  200. - (void)awakeFromNib {
  201. [super awakeFromNib];
  202. // Initialization code
  203. }
  204. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  205. [super setSelected:selected animated:animated];
  206. // Configure the view for the selected state
  207. }
  208. @end