From 59297eac774bc5ee9292a7d8467b2ea2220b9996 Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Tue, 16 Dec 2025 20:05:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai_key_icon.imageset/Contents.json | 22 +++++ .../ai_key_icon.imageset/ai_key_icon@2x.png | Bin 0 -> 2351 bytes .../ai_key_icon.imageset/ai_key_icon@3x.png | Bin 0 -> 4738 bytes .../View/EmojiView/KBEmojiBottomBarView.h | 13 +++ .../View/EmojiView/KBEmojiBottomBarView.m | 63 ++++++++++++ .../View/EmojiView/KBEmojiPanelView.m | 90 +++++------------- keyBoard.xcodeproj/project.pbxproj | 6 ++ 7 files changed, 128 insertions(+), 66 deletions(-) create mode 100644 CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/Contents.json create mode 100644 CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/ai_key_icon@2x.png create mode 100644 CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/ai_key_icon@3x.png create mode 100644 CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.h create mode 100644 CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.m diff --git a/CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/Contents.json b/CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/Contents.json new file mode 100644 index 0000000..bf66ad0 --- /dev/null +++ b/CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ai_key_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ai_key_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/ai_key_icon@2x.png b/CustomKeyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/ai_key_icon@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..6cf190c0b0fac0c417c58b9d54064a5ef8e63656 GIT binary patch literal 2351 zcmV+~3DEY5P)crH1go9 ziHR}#piv%-`XmM=G(i#n#fU)&N&$;4+alKfvBK_Lzh`#l_U?3cJMGS&{WFt(_uRSn z&bjw~?wPYYyOmVs_(!SLMWvp$l=W#*S-(SPA=Tny2ESWM?JO$wBr~dlkbD6vrBv!!00eoz0J)0K+gg^rPP*bvJL{`18~p= z0jNqv6&Wz_hr#S;MDtcJGHxroHQ1yXn?RIvfJ9I)oX z+&b5qZH-vQI@&CfTcm~0xDenHcDa;)`8-N-eq;Zp<#MwLkZ%QGwa$zXR06h2<#U&r zoPw3D4HD_0i#uDPI8=49F}$Ao5OqmBQ%^@ zB7)utmh*|jv|O&H6tDx$4>E(}de?HmO;DzU3 z_h%o!{8g>ZuYa@F@lQthElw>+yo0swF#Bj`A%az1{mk>zC!f*lefO2=qbFXN*BnnC z9w@t>{Ux=Dbq9E0&o|^f{`m0#{XH@|FUVdW2?Abt4h}nSPLBOeC%)hBWn-WJw)<-U z4mMZL|Mo@3OW1P_>aVUM_y{1XVhPXU+*0c3UPJCN(9eK_r85g3z1-_un_vVhL`HpR zVAoeJ59++Gn=bCXQJ?4cAENPqX~GH%F#OcIF?AEchxFA$Ij{()C<8_QhAatrC>d+a&j%QKi07*VhH$!Tx<@riZS+%^Knb z8`qOuyhxK8+Vj0`s|3fwo0Go4DOBnkbv*zllbg(3I=J&o2Ln+yx0KFXcPSv2<|T3d zzwXO*`)Qyhr-`9FjU5_rFc5X%&CSZlvN?71Y}D;s zIPt~avUYD2TJ;sds_JCDlMnlRsK5Ntc-iKwXU%7MPx;5SlL68MZ-l9^=N;6a6Ty5t zGUy+<)7ui>S@`xHfj+H<}!(oF@F=XJc*IYufJqN(E$LQ$0L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eyboard/KeyboardAssets.xcassets/ai_key_icon.imageset/ai_key_icon@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..7cd9601bc396faa5090fad0e0ea1c7caac37792e GIT binary patch literal 4738 zcmV-|5`FE7P)(k2XX8K286^h5aqP}BXMFN0+L^X z5gkt2K2!- zYwc0sYXE(;3vvUX4Z2wx3W!;2cVxu-Y)<4!;80HNH-XQ2V)p_&00W4F?W7IpgU#^E zM}Xf1zUhe^hQIzUBe`EeP;6`@DC!18*4j_^iTxK9{W2W>ivR*ZFmMMLJkfSQP{3FA zQzGUsGGY(Wm-T`oHXsmDTV`$cFSFu(9YL@k%7-8ofDt-66Wsl!Y5NbuZy$m$|6$(d z{&dF9Y>x|!ssS-$7w?;u+~14n=P?WV0XV^}2&=#jgBZi_7+L%Ev|YSgs$3NT!HQP& zZ>`A35mkKvf}!b%bZwfS#VcjAzMObJC8FQp#Fw(GBp|L~DY0Vkte|^5RCHL)tD^47 ziuuyCwOioo!lxu4`efkooY;eIRj?~HTMPH;gw3tkk7XtEL?IeL3IQ=;v!6!#x3DT; zn^?^=!;K9-Mj-lj=o8V;<$W)_{D64Z+KoB!em^G`4;>bj9lRDj16b%GsE?9}<1AZg zpf7l7@P7BAo!#LF1YR$7Q8GV|hsa%#$U#u}5#%JSv>dzS(4L?UN+OQ4tP_Cm_Y8>n z^=YnNcO5=G200C zm6C{ZrX2*~+%y!XJ>bd0He*EZ!))LYCjuhbt3wV$CD31?B%+*Y2V1aBGq%Wz-LWXT zmp_O+!dd1Zm=L`VdyoOK+hXPsUS5*-3fwr07RZUW*W|?R4xem2Y$PFfQn2*)7Odzt ztPrw^D}#f@meC$qth}Lp>v5J7tWQa-6vutG8*9Z_tPDQzg%7$fg8V?T44L=@X%KuI zhY|2;$PONDm`6R%a)P=ki529=%YhfoP^>vN_7@+5;>29`?c8q}LD zEGNR5)hW*V6V>j|{G1R1n@BXagV0|C9!VcIn1k0|7hs_QvSqWzz!F)=hQ=Ip92>jGeI}}z34^P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d8fEhn6Mjg{rD-FuW}eQh`oR0HZ1im7{}n~h-|#G@{eW&*Yy*xN){)im9|1*%%`$$ z?Hm&sL&rF8+zl8za=fb9*JIxwz$($IF>HUh@^3A9UWtPoWr`zVUda37T>7|ZsFkU5X3-X%Vf^{WWN!NJ)fhykMr2M1??&;ll0E}Yb5{T7m7 z`!zK#tPp}V!a+rx9Yh2Hp)iDlvp`^h#BCXT(hZm2Mmg&_sI12Rmr3GbpD2m2Z{?h62gM{_4(uV*FXqLR>Lq8) zVH7WzMHw6uPmUT9t0Gt<9D30X@cQvV85}ohkr@>|qGDzZ!odNS=si26 z)wBO`P-M#df@*HTc>kFaIkn7SSmyrKla5G)&9ESxTbo+*ZB?~KaD7tOT~d`lH=-Fu z+Ci{J^a^w#rSc~SRQ><>h>`sDQ5}3rtbEmoW`UMPuEMkgby5sNL z@yNiyNw~b^QxOm>J%EayEIgJ{{fZGhbRZ;}UXE6I8`!0=oY&$kOAs=6PJB`|^=l7e z;?vjVFy$FxnoG(3n)*GX=2unZWgrcRgZMTuBEF3KLrrDd0Qm{#5E82ULGOC34WHekP^*H^6g7bR6&ianMfMz)ShR zN9c?2&sTxZi0UJrF`s|in6Ev6->am7>qh_p0RR7ya*uZa000I_L_t&o04>GUFsaB% Q&;S4c07*qoM6N<$f=`|euK)l5 literal 0 HcmV?d00001 diff --git a/CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.h b/CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.h new file mode 100644 index 0000000..8178309 --- /dev/null +++ b/CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.h @@ -0,0 +1,13 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface KBEmojiBottomBarView : UIView + +@property (nonatomic, strong, readonly) UIScrollView *tabScrollView; +@property (nonatomic, strong, readonly) UIStackView *tabStackView; +@property (nonatomic, strong, readonly) UIButton *deleteButton; + +@end + +NS_ASSUME_NONNULL_END diff --git a/CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.m b/CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.m new file mode 100644 index 0000000..a7c41a4 --- /dev/null +++ b/CustomKeyboard/View/EmojiView/KBEmojiBottomBarView.m @@ -0,0 +1,63 @@ +#import "KBEmojiBottomBarView.h" +#import "Masonry.h" + +@interface KBEmojiBottomBarView () + +@property (nonatomic, strong, readwrite) UIScrollView *tabScrollView; +@property (nonatomic, strong, readwrite) UIStackView *tabStackView; +@property (nonatomic, strong, readwrite) UIButton *deleteButton; + +@end + +@implementation KBEmojiBottomBarView + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self setupUI]; + } + return self; +} + +- (void)setupUI { + self.backgroundColor = [UIColor clearColor]; + + self.tabScrollView = [[UIScrollView alloc] init]; + self.tabScrollView.showsHorizontalScrollIndicator = NO; + self.tabScrollView.backgroundColor = [UIColor clearColor]; + [self addSubview:self.tabScrollView]; + + self.tabStackView = [[UIStackView alloc] init]; + self.tabStackView.axis = UILayoutConstraintAxisHorizontal; + self.tabStackView.spacing = 8; + self.tabStackView.alignment = UIStackViewAlignmentFill; + [self.tabScrollView addSubview:self.tabStackView]; + + self.deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; + self.deleteButton.layer.cornerRadius = 16; + self.deleteButton.layer.masksToBounds = YES; +// self.deleteButton.titleLabel.font = [UIFont systemFontOfSize:24 weight:UIFontWeightSemibold]; +// [self.deleteButton setTitle:@"⌫" forState:UIControlStateNormal]; + [self.deleteButton setImage:[UIImage imageNamed:@"kb_del_icon"] forState:UIControlStateNormal]; + [self addSubview:self.deleteButton]; + + [self.tabScrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.mas_left).offset(12); + make.right.equalTo(self.deleteButton.mas_left).offset(-12); + make.top.equalTo(self.mas_top).offset(4); + make.bottom.equalTo(self.mas_bottom).offset(-4); + }]; + + [self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.tabScrollView); + make.height.equalTo(self.tabScrollView); + }]; + + [self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.mas_right).offset(-12); + make.centerY.equalTo(self); + make.width.mas_equalTo(44); + make.height.equalTo(self.tabScrollView); + }]; +} + +@end diff --git a/CustomKeyboard/View/EmojiView/KBEmojiPanelView.m b/CustomKeyboard/View/EmojiView/KBEmojiPanelView.m index 34ca9b3..36653f2 100644 --- a/CustomKeyboard/View/EmojiView/KBEmojiPanelView.m +++ b/CustomKeyboard/View/EmojiView/KBEmojiPanelView.m @@ -9,6 +9,7 @@ #import "KBLocalizationManager.h" #import "Masonry.h" #import "KBEmojiCollectionCell.h" +#import "KBEmojiBottomBarView.h" @interface KBEmojiPanelView () @@ -16,10 +17,7 @@ @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UIButton *backButton; @property (nonatomic, strong) UICollectionView *collectionView; -@property (nonatomic, strong) UIView *bottomBar; -@property (nonatomic, strong) UIScrollView *tabScrollView; -@property (nonatomic, strong) UIStackView *tabStackView; -@property (nonatomic, strong) UIButton *deleteButton; +@property (nonatomic, strong) KBEmojiBottomBarView *bottomBar; //@property (nonatomic, strong) UIButton *searchButton; @property (nonatomic, strong) NSArray *tabButtons; @property (nonatomic, strong) KBEmojiDataProvider *dataProvider; @@ -59,7 +57,7 @@ [self addSubview:topBar]; self.backButton = [UIButton buttonWithType:UIButtonTypeSystem]; - self.backButton.titleLabel.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold]; + self.backButton.titleLabel.font = [UIFont systemFontOfSize:30 weight:UIFontWeightSemibold]; [self.backButton setTitle:@"⌨︎" forState:UIControlStateNormal]; [self.backButton addTarget:self action:@selector(onBack) forControlEvents:UIControlEventTouchUpInside]; [topBar addSubview:self.backButton]; @@ -97,9 +95,9 @@ [self.collectionView registerClass:KBEmojiCollectionCell.class forCellWithReuseIdentifier:@"KBEmojiCollectionCell"]; [self addSubview:self.collectionView]; - self.bottomBar = [[UIView alloc] init]; - self.bottomBar.backgroundColor = [UIColor clearColor]; + self.bottomBar = [[KBEmojiBottomBarView alloc] init]; [self addSubview:self.bottomBar]; + [self.bottomBar.deleteButton addTarget:self action:@selector(onDelete) forControlEvents:UIControlEventTouchUpInside]; // self.searchButton = [UIButton buttonWithType:UIButtonTypeSystem]; // self.searchButton.layer.cornerRadius = 20; @@ -109,26 +107,6 @@ // [self.searchButton addTarget:self action:@selector(onSearch) forControlEvents:UIControlEventTouchUpInside]; // [self.bottomBar addSubview:self.searchButton]; - self.tabScrollView = [[UIScrollView alloc] init]; - self.tabScrollView.showsHorizontalScrollIndicator = NO; - self.tabScrollView.backgroundColor = [UIColor clearColor]; - [self.bottomBar addSubview:self.tabScrollView]; - - self.tabStackView = [[UIStackView alloc] init]; - self.tabStackView.axis = UILayoutConstraintAxisHorizontal; - self.tabStackView.spacing = 8; - self.tabStackView.alignment = UIStackViewAlignmentFill; - [self.tabScrollView addSubview:self.tabStackView]; - - self.deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; - self.deleteButton.layer.cornerRadius = 16; - self.deleteButton.layer.masksToBounds = YES; - self.deleteButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightSemibold]; - [self.deleteButton setTitle:@"⌫" forState:UIControlStateNormal]; - [self.deleteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [self.deleteButton addTarget:self action:@selector(onDelete) forControlEvents:UIControlEventTouchUpInside]; - [self.bottomBar addSubview:self.deleteButton]; - [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.mas_left).offset(12); make.right.equalTo(self.mas_right).offset(-12); @@ -141,32 +119,6 @@ make.height.mas_equalTo(40); }]; -// [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) { -// make.right.equalTo(self.bottomBar.mas_right).offset(-16); -// make.centerY.equalTo(self.bottomBar); -// make.width.mas_equalTo(84); -// make.height.mas_equalTo(40); -// }]; - - [self.tabScrollView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.bottomBar.mas_left).offset(12); - make.right.equalTo(self.deleteButton.mas_left).offset(-12); - make.top.equalTo(self.bottomBar.mas_top).offset(4); - make.bottom.equalTo(self.bottomBar.mas_bottom).offset(-4); - }]; - - [self.tabStackView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.equalTo(self.tabScrollView); - make.height.equalTo(self.tabScrollView); - }]; - - [self.deleteButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.bottomBar.mas_right).offset(-12); - make.centerY.equalTo(self.bottomBar); - make.width.mas_equalTo(44); - make.height.equalTo(self.tabScrollView); - }]; - UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(onSwipe:)]; leftSwipe.direction = UISwipeGestureRecognizerDirectionLeft; [self addGestureRecognizer:leftSwipe]; @@ -191,12 +143,13 @@ btn.layer.cornerCurve = kCACornerCurveContinuous; } } - if (self.deleteButton) { - CGFloat radius = MIN(CGRectGetHeight(self.deleteButton.bounds), CGRectGetWidth(self.deleteButton.bounds)) / 2.0; + UIButton *deleteButton = self.bottomBar.deleteButton; + if (deleteButton) { + CGFloat radius = MIN(CGRectGetHeight(deleteButton.bounds), CGRectGetWidth(deleteButton.bounds)) / 2.0; if (radius > 0) { - self.deleteButton.layer.cornerRadius = radius; + deleteButton.layer.cornerRadius = radius; if (@available(iOS 13.0, *)) { - self.deleteButton.layer.cornerCurve = kCACornerCurveContinuous; + deleteButton.layer.cornerCurve = kCACornerCurveContinuous; } } } @@ -232,8 +185,10 @@ } - (void)rebuildTabButtons { - for (UIView *v in self.tabStackView.arrangedSubviews) { - [self.tabStackView removeArrangedSubview:v]; + UIStackView *stackView = self.bottomBar.tabStackView; + if (!stackView) { return; } + for (UIView *v in stackView.arrangedSubviews) { + [stackView removeArrangedSubview:v]; [v removeFromSuperview]; } NSMutableArray *buttons = [NSMutableArray arrayWithCapacity:self.categories.count]; @@ -248,8 +203,8 @@ [btn addTarget:self action:@selector(onTabTapped:) forControlEvents:UIControlEventTouchUpInside]; btn.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, 12); btn.translatesAutoresizingMaskIntoConstraints = NO; -// [btn.heightAnchor constraintEqualTo:self.tabScrollView.heightAnchor].active = YES; - [self.tabStackView addArrangedSubview:btn]; +// [btn.heightAnchor constraintEqualTo:self.bottomBar.tabScrollView.heightAnchor].active = YES; + [stackView addArrangedSubview:btn]; [buttons addObject:btn]; }]; self.tabButtons = buttons.copy; @@ -287,10 +242,13 @@ - (void)scrollTabToVisible:(NSInteger)index { if (index < 0 || index >= self.tabButtons.count) return; + UIScrollView *scrollView = self.bottomBar.tabScrollView; + UIStackView *stackView = self.bottomBar.tabStackView; + if (!scrollView || !stackView) { return; } UIButton *btn = self.tabButtons[index]; - CGRect rect = [self.tabScrollView convertRect:btn.frame fromView:self.tabStackView]; + CGRect rect = [scrollView convertRect:btn.frame fromView:stackView]; rect = CGRectInset(rect, -12, 0); - [self.tabScrollView scrollRectToVisible:rect animated:YES]; + [scrollView scrollRectToVisible:rect animated:YES]; } #pragma mark - Actions @@ -351,10 +309,10 @@ self.tabNormalColor = [UIColor colorWithWhite:1 alpha:0.08]; self.tabSelectedColor = theme.accentColor ?: [UIColor colorWithWhite:1 alpha:0.25]; [self updateTabHighlightStates]; - if (self.deleteButton) { - self.deleteButton.backgroundColor = self.tabNormalColor; + if (self.bottomBar.deleteButton) { + self.bottomBar.deleteButton.backgroundColor = self.tabNormalColor; UIColor *deleteTitleColor = theme.keyTextColor ?: [UIColor whiteColor]; - [self.deleteButton setTitleColor:deleteTitleColor forState:UIControlStateNormal]; + [self.bottomBar.deleteButton setTitleColor:deleteTitleColor forState:UIControlStateNormal]; } if (self.magnifierView) { self.magnifierView.backgroundColor = theme.keyBackground ?: [UIColor colorWithWhite:1 alpha:0.9]; diff --git a/keyBoard.xcodeproj/project.pbxproj b/keyBoard.xcodeproj/project.pbxproj index ecff023..943fe87 100644 --- a/keyBoard.xcodeproj/project.pbxproj +++ b/keyBoard.xcodeproj/project.pbxproj @@ -197,6 +197,7 @@ 04FC970F2EB334F8007BD342 /* KBWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FC970D2EB334F8007BD342 /* KBWebImageManager.m */; }; 04FEDAA12EEDB00100123456 /* KBEmojiDataProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */; }; 04FEDAB32EEDB05000123456 /* KBEmojiPanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */; }; + 04FEDB032EFE000000123456 /* KBEmojiBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04FEDB022EFE000000123456 /* KBEmojiBottomBarView.m */; }; 471CAD3574798685B72ADD55 /* KBMyTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */; }; 49B63DBAEE9076C591E13D68 /* KBShopThemeTagModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E2A844CD2D8584596DBE6316 /* KBShopThemeTagModel.m */; }; 550CB2630FA4A7B4B9782EFA /* KBMyTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */; }; @@ -570,6 +571,8 @@ 04FEDAA02EEDB00100123456 /* KBEmojiDataProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiDataProvider.m; sourceTree = ""; }; 04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiPanelView.h; sourceTree = ""; }; 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiPanelView.m; sourceTree = ""; }; + 04FEDB012EFE000000123456 /* KBEmojiBottomBarView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBEmojiBottomBarView.h; sourceTree = ""; }; + 04FEDB022EFE000000123456 /* KBEmojiBottomBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBEmojiBottomBarView.m; sourceTree = ""; }; 180D662EC4DB3A7FFF83FF18 /* KBMyTheme.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBMyTheme.m; sourceTree = ""; }; 2C1092FB2B452F95B15D4263 /* Pods_CustomKeyboard.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CustomKeyboard.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 35E2B1C590E060D912A4E7F4 /* KBShopThemeTagModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBShopThemeTagModel.h; sourceTree = ""; }; @@ -1014,6 +1017,8 @@ children = ( 04FEDAB12EEDB05000123456 /* KBEmojiPanelView.h */, 04FEDAB22EEDB05000123456 /* KBEmojiPanelView.m */, + 04FEDB012EFE000000123456 /* KBEmojiBottomBarView.h */, + 04FEDB022EFE000000123456 /* KBEmojiBottomBarView.m */, 0450AA722EF013D000B6AF06 /* KBEmojiCollectionCell.h */, 0450AA732EF013D000B6AF06 /* KBEmojiCollectionCell.m */, ); @@ -1812,6 +1817,7 @@ 04C6EADD2EAF8CEB0089C901 /* KBToolBar.m in Sources */, 04FC95792EB09BC8007BD342 /* KBKeyBoardMainView.m in Sources */, 04FEDAB32EEDB05000123456 /* KBEmojiPanelView.m in Sources */, + 04FEDB032EFE000000123456 /* KBEmojiBottomBarView.m in Sources */, 0498BD8C2EE69E15006CC1D5 /* KBTagItemModel.m in Sources */, 046131142ECF454500A6FADF /* KBKeyPreviewView.m in Sources */, 04FC95732EB09570007BD342 /* KBFunctionBarView.m in Sources */,