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,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

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

View File

@@ -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>

View File

@@ -29,6 +29,7 @@
04286A0F2ECDA71B00CE730C /* 001.zip in Resources */ = {isa = PBXBuildFile; fileRef = 04286A0E2ECDA71B00CE730C /* 001.zip */; };
04286A132ECDEBF900CE730C /* KBSkinIconMap.strings in Resources */ = {isa = PBXBuildFile; fileRef = 04286A122ECDEBF900CE730C /* KBSkinIconMap.strings */; };
043FBCD22EAF97630036AFE1 /* KBPermissionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C6EAE12EAF940F0089C901 /* KBPermissionViewController.m */; };
0450AA742EF013D000B6AF06 /* KBEmojiCollectionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */; };
0459D1B42EBA284C00F2D189 /* KBSkinCenterVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */; };
0459D1B72EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; };
0459D1B82EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; };
@@ -262,6 +263,8 @@
04286A0A2ECD88B400CE730C /* KeyboardAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = KeyboardAssets.xcassets; sourceTree = "<group>"; };
04286A0E2ECDA71B00CE730C /* 001.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = 001.zip; sourceTree = "<group>"; };
04286A122ECDEBF900CE730C /* KBSkinIconMap.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = KBSkinIconMap.strings; sourceTree = "<group>"; };
0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiCollectionCell.h; sourceTree = "<group>"; };
0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiCollectionCell.m; sourceTree = "<group>"; };
0459D1B22EBA284C00F2D189 /* KBSkinCenterVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinCenterVC.h; sourceTree = "<group>"; };
0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinCenterVC.m; sourceTree = "<group>"; };
0459D1B52EBA287900F2D189 /* KBSkinManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinManager.h; sourceTree = "<group>"; };
@@ -941,6 +944,10 @@
0498BDF62EEFF585006CC1D5 /* EmojiView */ = {
isa = PBXGroup;
children = (
04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */,
04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */,
0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */,
0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */,
);
path = EmojiView;
sourceTree = "<group>";
@@ -1039,8 +1046,6 @@
046131132ECF454500A6FADF /* KBKeyPreviewView.m */,
04FC95772EB09BC8007BD342 /* KBKeyBoardMainView.h */,
04FC95782EB09BC8007BD342 /* KBKeyBoardMainView.m */,
04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */,
04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */,
04FC956E2EB09516007BD342 /* KBFunctionView.h */,
04FC956F2EB09516007BD342 /* KBFunctionView.m */,
04FC95712EB09570007BD342 /* KBFunctionBarView.h */,
@@ -1760,6 +1765,7 @@
04FC95672EB0546C007BD342 /* KBKey.m in Sources */,
A1B2C3F42EB35A9900000001 /* KBFullAccessGuideView.m in Sources */,
0498BD8F2EE6A3BD006CC1D5 /* KBMyMainModel.m in Sources */,
0450AA742EF013D000B6AF06 /* KBEmojiCollectionCell.m in Sources */,
550CB2630FA4A7B4B9782EFA /* KBMyTheme.m in Sources */,
0498BDDA2EE7ECEA006CC1D5 /* WJXEventSource.m in Sources */,
04D1F6B22EDFF10A00B12345 /* KBSkinInstallBridge.m in Sources */,