ScienceachievementsCell.m 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. //
  2. // ScienceachievementsCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/12.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "ScienceachievementsCell.h"
  9. @implementation ScienceachievementsCell
  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. _typelabel = [UILabel new];
  31. _typelabel.font = NewFont(14);
  32. _typelabel.textColor = NewWhiteColor;
  33. _typelabel.textAlignment = NSTextAlignmentCenter;
  34. [_image addSubview:_typelabel];
  35. _typelabel.sd_layout
  36. .leftEqualToView(_image)
  37. .heightIs(21)
  38. .rightEqualToView(_image)
  39. .topEqualToView(_typelabel);
  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(14);
  82. [_place setSingleLineAutoResizeWithMaxWidth:60];
  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 = NewButtonColor;
  96. _applyapplication2.font = NewFont(fitScreenWidth(12));
  97. ViewBorderRadius(_applyapplication2, 3, 1, NewButtonColor);
  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. .centerYEqualToView(planceimage)
  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:(AchievementslistModel *)model {
  128. _title.text = model.name;
  129. _content.text = model.introduction;
  130. _place.text = model.ownerPostalAddress;
  131. _follownumber.text = model.countInterest;
  132. _applyapplication1.text = model.field;
  133. _applyapplication2.text = model.fieldB;
  134. if ([model.boutique isEqualToString:@"0"]) {
  135. [_boutiqueimage setImage:NewImageNamed(@"")];
  136. }else if([model.boutique isEqualToString:@"1"]){
  137. [_boutiqueimage setImage:NewImageNamed(@"精品")];
  138. }
  139. CGFloat width = [NewUtils heightforString:model.field andHeight:18 fontSize:12];
  140. _applyapplication1.sd_layout
  141. .leftSpaceToView(self.contentView, fitScreenWidth(115))
  142. .bottomSpaceToView(self.contentView, 10)
  143. .heightIs(18)
  144. .widthIs(width+10);
  145. CGFloat width1 = [NewUtils heightforString:model.fieldB andHeight:18 fontSize:12];
  146. _applyapplication2.sd_layout
  147. .leftSpaceToView(_applyapplication1, fitScreenWidth(24))
  148. .bottomSpaceToView(self.contentView, 10)
  149. .heightIs(18)
  150. .widthIs(width1+10);
  151. if (!model.field) {
  152. _applyapplication1.hidden = YES;
  153. }else{
  154. _applyapplication1.hidden = NO;
  155. }
  156. if (!model.fieldB) {
  157. _applyapplication2.hidden = YES;
  158. }else{
  159. _applyapplication2.hidden = NO;
  160. }
  161. if ([model.category isEqualToString:@"0"]) {
  162. _typelabel.text = @"专利";
  163. }else if ([model.category isEqualToString:@"1"]){
  164. _typelabel.text = @"软著";
  165. }else if ([model.category isEqualToString:@"2"]){
  166. _typelabel.text = @"项目";
  167. }else if ([model.category isEqualToString:@"3"]){
  168. _typelabel.text = @"版权";
  169. }else if ([model.category isEqualToString:@"4"]){
  170. _typelabel.text = @"工业设计";
  171. }else if ([model.category isEqualToString:@"5"]){
  172. _typelabel.text = @"配方";
  173. }else if ([model.category isEqualToString:@"6"]){
  174. _typelabel.text = @"非标";
  175. }
  176. }
  177. - (void)awakeFromNib {
  178. [super awakeFromNib];
  179. // Initialization code
  180. }
  181. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  182. [super setSelected:selected animated:animated];
  183. // Configure the view for the selected state
  184. }
  185. @end