No Description

FKProductAnswerCell.m 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // FKProductAnswerCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 16/1/21.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKProductAnswerCell.h"
  9. @interface FKProductAnswerCell ()
  10. @end
  11. @implementation FKProductAnswerCell
  12. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  13. self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
  14. if (self) {
  15. [self addAnswerSubViews];
  16. }
  17. return self;
  18. }
  19. - (void)addAnswerSubViews {
  20. [self.contentView addSubview:self.aIconImageView];
  21. [self.aIconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.top.equalTo(self.qContentLabel.mas_bottom).offset(14);
  23. make.left.equalTo(self.contentView).offset(14);
  24. }];
  25. [self.contentView addSubview:self.aContentLabel];
  26. [self.aContentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.top.equalTo(self.aIconImageView).offset(0);
  28. make.left.equalTo(self.contentView).offset(35);
  29. make.right.equalTo(self.contentView).offset(-20);
  30. }];
  31. }
  32. #pragma mark - Property
  33. - (UIImageView *)aIconImageView {
  34. if (!_aIconImageView) {
  35. _aIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"advise_answer_icon"]];
  36. }
  37. return _aIconImageView;
  38. }
  39. - (UILabel *)aContentLabel {
  40. if (!_aContentLabel) {
  41. _aContentLabel = [UILabel new];
  42. _aContentLabel.font = [UIFont systemFontOfSize:14];
  43. _aContentLabel.numberOfLines = 0;
  44. _aContentLabel.textColor = UIColorFromRGB(0x999999);
  45. }
  46. return _aContentLabel;
  47. }
  48. #pragma mark - Method
  49. + (CGFloat)heightWith:(NSString *)answer question:(NSString *)question {
  50. CGSize size = [FLStringHelper rectOfString:answer
  51. font:[UIFont systemFontOfSize:14]
  52. width:(UISCREENWIDTH - 35 - 20)].size;
  53. return ([FKProductQuestionCell height:question] + 4 + size.height + 10);
  54. }
  55. @end