// // FKProductAdviseCell.m // FirstLink // // Created by ascii on 16/1/21. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKProductQuestionCell.h" @interface FKProductQuestionCell () @end @implementation FKProductQuestionCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier]; if (self) { [self addQuestionSubViews]; } return self; } - (void)addQuestionSubViews { UIView *line = [UIView new]; line.backgroundColor = UIColorFromRGB(0xcccccc); [self.contentView addSubview:line]; [line mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.equalTo(self.contentView); make.height.mas_equalTo(0.5); }]; [self.contentView addSubview:self.qNameLabel]; [self.qNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(8); make.left.equalTo(self.contentView).offset(14); }]; [self.contentView addSubview:self.qTimeLabel]; [self.qTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.qNameLabel); make.right.equalTo(self.contentView).offset(-14); }]; [self.contentView addSubview:self.qIconImageView]; [self.qIconImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.qNameLabel.mas_bottom).offset(4); make.left.equalTo(self.contentView).offset(14); }]; [self.contentView addSubview:self.qContentLabel]; [self.qContentLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(26); make.left.equalTo(self.contentView).offset(35); make.right.equalTo(self.contentView).offset(-20); }]; } #pragma mark - Property - (UILabel *)qNameLabel { if (!_qNameLabel) { _qNameLabel = [UILabel new]; _qNameLabel.font = [UIFont systemFontOfSize:13]; _qNameLabel.textColor = UIColorFromRGB(0xc3ccda); } return _qNameLabel; } - (UILabel *)qTimeLabel { if (!_qTimeLabel) { _qTimeLabel = [UILabel new]; _qTimeLabel.font = [UIFont systemFontOfSize:13]; _qTimeLabel.textColor = UIColorFromRGB(0xc3ccda); } return _qTimeLabel; } - (UIImageView *)qIconImageView { if (!_qIconImageView) { _qIconImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"advise_question_icon"]]; } return _qIconImageView; } - (UILabel *)qContentLabel { if (!_qContentLabel) { _qContentLabel = [UILabel new]; _qContentLabel.font = [UIFont systemFontOfSize:14]; _qContentLabel.numberOfLines = 0; _qContentLabel.textColor = UIColorFromRGB(0x666666); } return _qContentLabel; } #pragma mark - Method + (CGFloat)height:(NSString *)question { CGSize size = [FLStringHelper rectOfString:question font:[UIFont systemFontOfSize:14] width:(UISCREENWIDTH - 35 - 20)].size; return (26 + size.height + 10); } @end