No Description

FKProductQuestionCell.m 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // FKProductAdviseCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 16/1/21.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKProductQuestionCell.h"
  9. @interface FKProductQuestionCell ()
  10. @end
  11. @implementation FKProductQuestionCell
  12. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  13. self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
  14. if (self) {
  15. [self addQuestionSubViews];
  16. }
  17. return self;
  18. }
  19. - (void)addQuestionSubViews {
  20. UIView *line = [UIView new];
  21. line.backgroundColor = UIColorFromRGB(0xcccccc);
  22. [self.contentView addSubview:line];
  23. [line mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.left.right.top.equalTo(self.contentView);
  25. make.height.mas_equalTo(0.5);
  26. }];
  27. [self.contentView addSubview:self.qNameLabel];
  28. [self.qNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.top.equalTo(self.contentView).offset(8);
  30. make.left.equalTo(self.contentView).offset(14);
  31. }];
  32. [self.contentView addSubview:self.qTimeLabel];
  33. [self.qTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.centerY.equalTo(self.qNameLabel);
  35. make.right.equalTo(self.contentView).offset(-14);
  36. }];
  37. [self.contentView addSubview:self.qIconImageView];
  38. [self.qIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.top.equalTo(self.qNameLabel.mas_bottom).offset(4);
  40. make.left.equalTo(self.contentView).offset(14);
  41. }];
  42. [self.contentView addSubview:self.qContentLabel];
  43. [self.qContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.top.equalTo(self.contentView).offset(26);
  45. make.left.equalTo(self.contentView).offset(35);
  46. make.right.equalTo(self.contentView).offset(-20);
  47. }];
  48. }
  49. #pragma mark - Property
  50. - (UILabel *)qNameLabel {
  51. if (!_qNameLabel) {
  52. _qNameLabel = [UILabel new];
  53. _qNameLabel.font = [UIFont systemFontOfSize:13];
  54. _qNameLabel.textColor = UIColorFromRGB(0xc3ccda);
  55. }
  56. return _qNameLabel;
  57. }
  58. - (UILabel *)qTimeLabel {
  59. if (!_qTimeLabel) {
  60. _qTimeLabel = [UILabel new];
  61. _qTimeLabel.font = [UIFont systemFontOfSize:13];
  62. _qTimeLabel.textColor = UIColorFromRGB(0xc3ccda);
  63. }
  64. return _qTimeLabel;
  65. }
  66. - (UIImageView *)qIconImageView {
  67. if (!_qIconImageView) {
  68. _qIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"advise_question_icon"]];
  69. }
  70. return _qIconImageView;
  71. }
  72. - (UILabel *)qContentLabel {
  73. if (!_qContentLabel) {
  74. _qContentLabel = [UILabel new];
  75. _qContentLabel.font = [UIFont systemFontOfSize:14];
  76. _qContentLabel.numberOfLines = 0;
  77. _qContentLabel.textColor = UIColorFromRGB(0x666666);
  78. }
  79. return _qContentLabel;
  80. }
  81. #pragma mark - Method
  82. + (CGFloat)height:(NSString *)question {
  83. CGSize size = [FLStringHelper rectOfString:question
  84. font:[UIFont systemFontOfSize:14]
  85. width:(UISCREENWIDTH - 35 - 20)].size;
  86. return (26 + size.height + 10);
  87. }
  88. @end