39 lines
1.3 KiB
Objective-C
39 lines
1.3 KiB
Objective-C
//
|
|
// 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
|