_contentLabel = [[YYLabel alloc] init];
_contentLabel.textAlignment = NSTextAlignmentLeft;
_contentLabel.font = App_font(14);
_contentLabel.text = @"这是默认评论数据";
_contentLabel.textColor = UIColorFromRGB(0x333333);
_contentLabel.numberOfLines = 0;
_contentLabel.preferredMaxLayoutWidth = kDeviceWidth - 30kDeviceRate -10kDeviceRate -100*kDeviceRate;
[self.contentView addSubview:_contentLabel];
[_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(wself.avatarIV.mas_right).offset(5*kDeviceRate);
make.top.mas_equalTo(wself.avatarLabel.mas_bottom).offset(15*kDeviceRate);
make.right.mas_equalTo(wself.contentView.mas_right);
}];
_timeLabel = [[UILabel alloc] init];
_timeLabel.textAlignment = NSTextAlignmentLeft;
_timeLabel.font = App_font(11);
_timeLabel.textColor = UIColorFromRGB(0x666666);
[self.contentView addSubview:_timeLabel];
CGSize userTimeSize = [[_timeLabel.attributedText string] sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:App_font(11),NSFontAttributeName, nil]];
_timeLabel.preferredMaxLayoutWidth = userTimeSize.width;
[_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(wself.contentLabel.mas_left);
make.top.mas_equalTo(wself.contentLabel.mas_bottom).offset(11*kDeviceRate);
make.height.mas_equalTo(11*kDeviceRate);
}];
网友评论