// // FKProductAnswerCell.m // FirstLink // // Created by ascii on 16/1/21. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKProductAnswerCell.h" @interface FKProductAnswerCell () @end @implementation FKProductAnswerCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier]; if (self) { [self addAnswerSubViews]; } return self; } - (void)addAnswerSubViews { [self.contentView addSubview:self.aIconImageView]; [self.aIconImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.qContentLabel.mas_bottom).offset(14); make.left.equalTo(self.contentView).offset(14); }]; [self.contentView addSubview:self.aContentLabel]; [self.aContentLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.aIconImageView).offset(0); make.left.equalTo(self.contentView).offset(35); make.right.equalTo(self.contentView).offset(-20); }]; } #pragma mark - Property - (UIImageView *)aIconImageView { if (!_aIconImageView) { _aIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"advise_answer_icon"]]; } return _aIconImageView; } - (UILabel *)aContentLabel { if (!_aContentLabel) { _aContentLabel = [UILabel new]; _aContentLabel.font = [UIFont systemFontOfSize:14]; _aContentLabel.numberOfLines = 0; _aContentLabel.textColor = UIColorFromRGB(0x999999); } return _aContentLabel; } #pragma mark - Method + (CGFloat)heightWith:(NSString *)answer question:(NSString *)question { CGSize size = [FLStringHelper rectOfString:answer font:[UIFont systemFontOfSize:14] width:(UISCREENWIDTH - 35 - 20)].size; return ([FKProductQuestionCell height:question] + 4 + size.height + 10); } @end