From 053001170a2cc706a25cde16f74bc9091afc8927 Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Mon, 15 Dec 2025 18:02:58 +0800 Subject: [PATCH] 1 --- .../View/EmojiView/KBEmojiCollectionCell.h | 17 +++++++++ .../View/EmojiView/KBEmojiCollectionCell.m | 38 +++++++++++++++++++ .../View/{ => EmojiView}/KBEmojiPanelView.h | 0 .../View/{ => EmojiView}/KBEmojiPanelView.m | 37 +----------------- keyBoard.xcodeproj/project.pbxproj | 10 ++++- 5 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.h create mode 100644 CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.m rename CustomKeyboard/View/{ => EmojiView}/KBEmojiPanelView.h (100%) rename CustomKeyboard/View/{ => EmojiView}/KBEmojiPanelView.m (93%) diff --git a/CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.h b/CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.h new file mode 100644 index 0000000..06e511f --- /dev/null +++ b/CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.h @@ -0,0 +1,17 @@ +// +// KBEmojiCollectionCell.h +// CustomKeyboard +// +// Created by Mac on 2025/12/15. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface KBEmojiCollectionCell : UICollectionViewCell +@property (nonatomic, strong) UILabel *emojiLabel; +- (void)configureWithEmoji:(NSString *)emoji; +@end + +NS_ASSUME_NONNULL_END diff --git a/CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.m b/CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.m new file mode 100644 index 0000000..9dbb366 --- /dev/null +++ b/CustomKeyboard/View/EmojiView/KBEmojiCollectionCell.m @@ -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 diff --git a/CustomKeyboard/View/KBEmojiPanelView.h b/CustomKeyboard/View/EmojiView/KBEmojiPanelView.h similarity index 100% rename from CustomKeyboard/View/KBEmojiPanelView.h rename to CustomKeyboard/View/EmojiView/KBEmojiPanelView.h diff --git a/CustomKeyboard/View/KBEmojiPanelView.m b/CustomKeyboard/View/EmojiView/KBEmojiPanelView.m similarity index 93% rename from CustomKeyboard/View/KBEmojiPanelView.m rename to CustomKeyboard/View/EmojiView/KBEmojiPanelView.m index 87cf1d3..48a1ee4 100644 --- a/CustomKeyboard/View/KBEmojiPanelView.m +++ b/CustomKeyboard/View/EmojiView/KBEmojiPanelView.m @@ -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 () diff --git a/keyBoard.xcodeproj/project.pbxproj b/keyBoard.xcodeproj/project.pbxproj index 5427f50..06ef2bf 100644 --- a/keyBoard.xcodeproj/project.pbxproj +++ b/keyBoard.xcodeproj/project.pbxproj @@ -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 = ""; }; 04286A0E2ECDA71B00CE730C /* 001.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = 001.zip; sourceTree = ""; }; 04286A122ECDEBF900CE730C /* KBSkinIconMap.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = KBSkinIconMap.strings; sourceTree = ""; }; + 0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiCollectionCell.h; sourceTree = ""; }; + 0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiCollectionCell.m; sourceTree = ""; }; 0459D1B22EBA284C00F2D189 /* KBSkinCenterVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinCenterVC.h; sourceTree = ""; }; 0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinCenterVC.m; sourceTree = ""; }; 0459D1B52EBA287900F2D189 /* KBSkinManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinManager.h; sourceTree = ""; }; @@ -941,6 +944,10 @@ 0498BDF62EEFF585006CC1D5 /* EmojiView */ = { isa = PBXGroup; children = ( + 04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */, + 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */, + 0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */, + 0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */, ); path = EmojiView; sourceTree = ""; @@ -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 */,