123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- //
- // 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
|