1
This commit is contained in:
17
CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.h
Normal file
17
CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// KBEmojiCollectionCell.h
|
||||
// CustomKeyboard
|
||||
//
|
||||
// Created by Mac on 2025/12/15.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface KBEmojiCollectionCell : UICollectionViewCell
|
||||
@property (nonatomic, strong) UILabel *emojiLabel;
|
||||
- (void)configureWithEmoji:(NSString *)emoji;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
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
|
||||
@@ -8,43 +8,8 @@
|
||||
#import "KBSkinManager.h"
|
||||
#import "KBLocalizationManager.h"
|
||||
#import "Masonry.h"
|
||||
#import "KBEmojiCollectionCell.h"
|
||||
|
||||
@interface KBEmojiCollectionCell : UICollectionViewCell
|
||||
@property (nonatomic, strong) UILabel *emojiLabel;
|
||||
- (void)configureWithEmoji:(NSString *)emoji;
|
||||
@end
|
||||
|
||||
@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
|
||||
|
||||
@interface KBEmojiPanelView () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
|
||||
Reference in New Issue
Block a user