Files
keyboard/keyBoard/Class/Guard/V/KBGuideKFCell.m

77 lines
2.3 KiB
Mathematica
Raw Normal View History

2025-10-29 16:26:57 +08:00
//
// KBGuideKFCell.m
// keyBoard
//
#import "KBGuideKFCell.h"
@interface KBGuideKFCell ()
2025-12-15 17:56:06 +08:00
@property (nonatomic, strong) UIImageView *avatarImageView; //
2025-10-29 16:26:57 +08:00
@property (nonatomic, strong) UIView *bubbleView; //
@property (nonatomic, strong) UILabel *contentLabel; //
@end
@implementation KBGuideKFCell
- (void)setupUI {
self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0];
2025-12-15 17:56:06 +08:00
[self.contentView addSubview:self.avatarImageView];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2025-10-29 16:26:57 +08:00
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) {
2025-12-15 17:56:06 +08:00
make.left.equalTo(self.avatarImageView.mas_right).offset(8);
2025-10-29 16:26:57 +08:00
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
2025-12-15 17:56:06 +08:00
- (UIImageView *)avatarImageView {
if (!_avatarImageView) {
_avatarImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"App_icon"]];
_avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
_avatarImageView.layer.cornerRadius = 18;
_avatarImageView.layer.masksToBounds = YES;
2025-10-29 16:26:57 +08:00
}
2025-12-15 17:56:06 +08:00
return _avatarImageView;
2025-10-29 16:26:57 +08:00
}
- (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;
2025-11-25 15:36:16 +08:00
_contentLabel.font = [KBFont regular:15];
2025-10-29 16:26:57 +08:00
_contentLabel.textColor = [UIColor colorWithWhite:0.15 alpha:1.0];
}
return _contentLabel;
}
@end