NewFWXMCell.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. //
  2. // NewFWXMCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2018/8/30.
  6. // Copyright © 2018年 罗云飞. All rights reserved.
  7. //
  8. #import "NewFWXMCell.h"
  9. @implementation NewFWXMCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. _imageview = [UIImageView new];
  14. [self.contentView addSubview:_imageview];
  15. _imageview.sd_layout
  16. .leftSpaceToView(self.contentView, 15)
  17. .topSpaceToView(self.contentView, 30)
  18. .heightIs(65)
  19. .widthIs(100);
  20. _guanzhuBT = [UIButton new];
  21. [_guanzhuBT setBackgroundImage:NewImageNamed(@"wpj") forState:UIControlStateNormal];
  22. [self.contentView addSubview:_guanzhuBT];
  23. _guanzhuBT.sd_layout
  24. .rightSpaceToView(self.contentView, 15)
  25. .heightIs(15)
  26. .widthIs(15)
  27. .topEqualToView(_imageview);
  28. _guanzhuNumber = [UILabel new];
  29. _guanzhuNumber.font = NewFont(13);
  30. [_guanzhuNumber setTextColor:[UIColor colorWithString:@"#AEAEAE"]];
  31. [_guanzhuNumber setSingleLineAutoResizeWithMaxWidth:0];
  32. [self.contentView addSubview:_guanzhuNumber];
  33. _guanzhuNumber.sd_layout
  34. .centerYEqualToView(_guanzhuBT)
  35. .heightIs(15)
  36. .rightSpaceToView(_guanzhuBT, 5);
  37. _title = [UILabel new];
  38. _title.font = NewFont(16);
  39. // [_title setSingleLineAutoResizeWithMaxWidth:0];
  40. _title.textAlignment = NSTextAlignmentLeft;
  41. [self.contentView addSubview:_title];
  42. _title.sd_layout
  43. .leftSpaceToView(_imageview, 15)
  44. .topEqualToView(_imageview)
  45. .heightIs(15)
  46. .rightSpaceToView(_guanzhuNumber, 15);
  47. UILabel *line = [UILabel new];
  48. line.backgroundColor = NewLineGrayColor;
  49. [self.contentView addSubview:line];
  50. line.sd_layout
  51. .leftSpaceToView(_imageview, 15)
  52. .heightIs(0.8)
  53. .rightSpaceToView(self.contentView, 15)
  54. .topSpaceToView(self.contentView, 55);
  55. _neirong = [UILabel new];
  56. _neirong.font = NewFont(14);
  57. _neirong.lineBreakMode = NSLineBreakByTruncatingTail;
  58. _neirong.numberOfLines = 1;
  59. _neirong.textColor = [UIColor colorWithString:@"#6C6C6C"];
  60. [self.contentView addSubview:_neirong];
  61. _neirong.sd_layout
  62. .leftEqualToView(line)
  63. .heightIs(15)
  64. .topSpaceToView(line, 5)
  65. .rightSpaceToView(self.contentView, 15);
  66. _jiage = [UILabel new];
  67. _jiage.textColor = [UIColor colorWithString:@"#0779D5"];
  68. _jiage.font = NewFont(15);
  69. [_jiage setSingleLineAutoResizeWithMaxWidth:0];
  70. [self.contentView addSubview:_jiage];
  71. _jiage.sd_layout
  72. .leftEqualToView(_neirong)
  73. .heightIs(15)
  74. .topSpaceToView(_neirong, 10);
  75. _gongsi = [UILabel new];
  76. _gongsi.font = NewFont(13);
  77. [_gongsi setSingleLineAutoResizeWithMaxWidth:0];
  78. _gongsi.textColor = [UIColor colorWithString:@"#6C6C6C"];
  79. [self.contentView addSubview:_gongsi];
  80. _gongsi.sd_layout
  81. .leftEqualToView(line)
  82. .heightIs(15)
  83. .bottomSpaceToView(self.contentView, 15);
  84. _banliBT = [UIButton new];
  85. [_banliBT setTitle:@"立即办理" forState:UIControlStateNormal];
  86. [_banliBT setTitleColor:[UIColor colorWithString:@"#0779D5"] forState:UIControlStateNormal];
  87. ViewBorderRadius(_banliBT, 3, 1, [UIColor colorWithString:@"#0779D5"]);
  88. _banliBT.titleLabel.font = NewFont(13);
  89. [self.contentView addSubview:_banliBT];
  90. _banliBT.sd_layout
  91. .rightSpaceToView(self.contentView, 15)
  92. .heightIs(20)
  93. .widthIs(70)
  94. .bottomEqualToView(_gongsi);
  95. UILabel *line1 = [UILabel new];
  96. line1.backgroundColor = NewLineGrayColor;
  97. [self.contentView addSubview:line1];
  98. line1.sd_layout
  99. .leftEqualToView(self.contentView)
  100. .rightEqualToView(self.contentView)
  101. .bottomEqualToView(self.contentView)
  102. .heightIs(0.8);
  103. }
  104. return self;
  105. }
  106. - (void)assignment:(NewFWXMModel *)model {
  107. [_imageview sd_setImageWithURL:NewURL([model.minImgUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"服务项目")];
  108. [_title setText:model.name];
  109. _guanzhuNumber.text = model.interestCount;
  110. if (model.companyName == NULL) {
  111. [_gongsi setText:@"未知发布者"];
  112. }else{
  113. [_gongsi setText:model.companyName];
  114. }
  115. if (model.advertisement == NULL || [model.advertisement isEqualToString:@""]) {
  116. _neirong.text = @"暂无简介";
  117. }else{
  118. _neirong.text = model.advertisement;
  119. }
  120. if (model.price == NULL) {
  121. _jiage.text = @"面议";
  122. }else{
  123. _jiage.text = [NSString stringWithFormat:@"¥%@万元",model.price];
  124. }
  125. }
  126. - (void)awakeFromNib {
  127. [super awakeFromNib];
  128. // Initialization code
  129. }
  130. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  131. [super setSelected:selected animated:animated];
  132. // Configure the view for the selected state
  133. }
  134. @end