1
This commit is contained in:
38
CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.m
Normal file
38
CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.m
Normal 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
|
||||
Reference in New Issue
Block a user