// // KBGuideKFCell.m // keyBoard // #import "KBGuideKFCell.h" @interface KBGuideKFCell () @property (nonatomic, strong) UIImageView *avatarImageView; // 左侧头像 @property (nonatomic, strong) UIView *bubbleView; // 气泡 @property (nonatomic, strong) UILabel *contentLabel; // 文案 @end @implementation KBGuideKFCell - (void)setupUI { self.contentView.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor clearColor]; [self.contentView addSubview:self.avatarImageView]; [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(16); make.top.equalTo(self.contentView).offset(10); make.width.height.mas_equalTo(36); }]; [self.contentView addSubview:self.bubbleView]; [self.bubbleView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.avatarImageView.mas_right).offset(8); make.top.equalTo(self.contentView).offset(8); make.right.lessThanOrEqualTo(self.contentView).offset(-80); make.bottom.equalTo(self.contentView).offset(-8); }]; [self.bubbleView addSubview:self.contentLabel]; [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(self.bubbleView).insets(UIEdgeInsetsMake(10, 12, 10, 12)); }]; } - (void)configText:(NSString *)text { self.contentLabel.text = text; } #pragma mark - Lazy - (UIImageView *)avatarImageView { if (!_avatarImageView) { _avatarImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"App_icon"]]; _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; _avatarImageView.layer.cornerRadius = 18; _avatarImageView.layer.masksToBounds = YES; } return _avatarImageView; } - (UIView *)bubbleView { if (!_bubbleView) { _bubbleView = [UIView new]; _bubbleView.backgroundColor = [UIColor whiteColor]; _bubbleView.layer.cornerRadius = 18; _bubbleView.layer.masksToBounds = YES; } return _bubbleView; } - (UILabel *)contentLabel { if (!_contentLabel) { _contentLabel = [UILabel new]; _contentLabel.numberOfLines = 0; _contentLabel.font = [KBFont regular:15]; _contentLabel.textColor = [UIColor colorWithWhite:0.15 alpha:1.0]; } return _contentLabel; } @end