This commit is contained in:
2025-12-15 18:02:58 +08:00
parent 9cafb0f70e
commit 053001170a
5 changed files with 64 additions and 38 deletions

View File

@@ -0,0 +1,38 @@
//
// KBEmojiCollectionCell.m
// CustomKeyboard
//
// Created by Mac on 2025/12/15.
//
#import "KBEmojiCollectionCell.h"
@implementation KBEmojiCollectionCell
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
_emojiLabel = [[UILabel alloc] init];
_emojiLabel.font = [UIFont systemFontOfSize:32];
_emojiLabel.textAlignment = NSTextAlignmentCenter;
_emojiLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_emojiLabel];
[NSLayoutConstraint activateConstraints:@[
[_emojiLabel.topAnchor constraintEqualToAnchor:self.contentView.topAnchor],
[_emojiLabel.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor],
[_emojiLabel.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor],
[_emojiLabel.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor],
]];
self.contentView.layer.cornerRadius = 10;
self.contentView.layer.masksToBounds = YES;
}
return self;
}
- (void)prepareForReuse {
[super prepareForReuse];
self.emojiLabel.text = @"";
}
- (void)configureWithEmoji:(NSString *)emoji {
self.emojiLabel.text = emoji ?: @"";
}
@end