修改键盘UI

This commit is contained in:
2025-11-20 20:17:19 +08:00
parent b2994adc1c
commit 8296ac12b6
4 changed files with 46 additions and 20 deletions

View File

@@ -227,6 +227,7 @@
"backspace" = "key_del"; "backspace" = "key_del";
/* Shift */ /* Shift */
"shift" = "key_up"; "shift" = "key_up";
/* Shift大写 */
"shift_upper" = "key_up_upper"; "shift_upper" = "key_up_upper";
/* 字母面板左下角 "123" */ /* 字母面板左下角 "123" */
"mode_123" = "key_123"; "mode_123" = "key_123";

Binary file not shown.

View File

@@ -226,6 +226,10 @@
title:@"⇧" title:@"⇧"
output:@"" output:@""
type:KBKeyTypeShift]; type:KBKeyTypeShift];
// Shift
// - shift.caseVariant = Lower 使 KBSkinIconMap "shift"
// - shift.caseVariant = Upper 使 "shift_upper"
shift.caseVariant = self.shiftOn ? KBKeyCaseVariantUpper : KBKeyCaseVariantLower;
[row3 addObject:shift]; [row3 addObject:shift];
for (NSString *s in r3chars) { for (NSString *s in r3chars) {
NSString *shown = self.shiftOn ? s : s.lowercaseString; NSString *shown = self.shiftOn ? s : s.lowercaseString;
@@ -357,14 +361,35 @@
// //
KBKeyButton *firstChar = nil; KBKeyButton *firstChar = nil;
BOOL hasCharacterInRow = NO;
for (KBKeyButton *b in row.subviews) { for (KBKeyButton *b in row.subviews) {
if ([b isKindOfClass:[KBKeyButton class]] && b.key.type == KBKeyTypeCharacter) { firstChar = b; break; } if (![b isKindOfClass:[KBKeyButton class]]) continue;
if (b.key.type == KBKeyTypeCharacter) {
firstChar = b;
hasCharacterInRow = YES;
break;
}
} }
// 使 // 使
if (!firstChar) { if (!firstChar) {
for (KBKeyButton *b in row.subviews) { if ([b isKindOfClass:[KBKeyButton class]]) { firstChar = b; break; } } for (KBKeyButton *b in row.subviews) {
if ([b isKindOfClass:[KBKeyButton class]]) {
firstChar = b;
break;
}
}
} }
if (firstChar) { if (firstChar) {
// 123/ABC/AI/#+=
// 1:1 123/ABC
if (!hasCharacterInRow &&
(firstChar.key.type == KBKeyTypeModeChange ||
firstChar.key.type == KBKeyTypeSymbolsToggle ||
firstChar.key.type == KBKeyTypeCustom)) {
[firstChar mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(firstChar.mas_height);
}];
}
for (KBKeyButton *b in row.subviews) { for (KBKeyButton *b in row.subviews) {
if (![b isKindOfClass:[KBKeyButton class]]) continue; if (![b isKindOfClass:[KBKeyButton class]]) continue;
// firstChar // firstChar
@@ -372,30 +397,30 @@
if (b == firstChar) continue; if (b == firstChar) continue;
if (b.key.type == KBKeyTypeCharacter) continue; if (b.key.type == KBKeyTypeCharacter) continue;
// Shift Backspace 1:1 = // 1:1
// // - ShiftBackspace
if (b.key.type == KBKeyTypeShift || b.key.type == KBKeyTypeBackspace) { // - 123/ABCModeChange#+=SymbolsToggleAICustom
BOOL isBottomModeKey = (b.key.type == KBKeyTypeModeChange) ||
(b.key.type == KBKeyTypeSymbolsToggle) ||
(b.key.type == KBKeyTypeCustom);
if (b.key.type == KBKeyTypeShift ||
b.key.type == KBKeyTypeBackspace ||
isBottomModeKey) {
[b mas_makeConstraints:^(MASConstraintMaker *make) { [b mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(b.mas_height); make.width.equalTo(b.mas_height); // =
}]; }];
continue; continue;
} }
CGFloat multiplier = 1.5; CGFloat multiplier = 1.5;
// Space // Space 4.0 3.0
if (b.key.type == KBKeyTypeSpace) { if (b.key.type == KBKeyTypeSpace) {
multiplier = 4.0; multiplier = 3.0;
} }
// Send 2.6 // Send 2.4
else if (b.key.type == KBKeyTypeReturn) { else if (b.key.type == KBKeyTypeReturn) {
multiplier = 2.6; multiplier = 2.4;
}
// 123/ABC#+=AI1
else if (b.key.type == KBKeyTypeModeChange ||
b.key.type == KBKeyTypeSymbolsToggle ||
b.key.type == KBKeyTypeCustom) {
multiplier = 1.0;
} }
// Globe // Globe
else if (b.key.type == KBKeyTypeGlobe) { else if (b.key.type == KBKeyTypeGlobe) {

View File

@@ -36,7 +36,7 @@
0459D1B42EBA284C00F2D189 /* KBSkinCenterVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */; }; 0459D1B42EBA284C00F2D189 /* KBSkinCenterVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */; };
0459D1B72EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; }; 0459D1B72EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; };
0459D1B82EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; }; 0459D1B82EBA287900F2D189 /* KBSkinManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 0459D1B62EBA287900F2D189 /* KBSkinManager.m */; };
0461310F2ECF0FBC00A6FADF /* fense.zip in Resources */ = {isa = PBXBuildFile; fileRef = 0461310E2ECF0FBC00A6FADF /* fense.zip */; }; 046131112ECF3A6E00A6FADF /* fense.zip in Resources */ = {isa = PBXBuildFile; fileRef = 046131102ECF3A6E00A6FADF /* fense.zip */; };
0477BD952EBAFF4E0055D639 /* KBURLOpenBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 0477BD932EBAFF4E0055D639 /* KBURLOpenBridge.m */; }; 0477BD952EBAFF4E0055D639 /* KBURLOpenBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 0477BD932EBAFF4E0055D639 /* KBURLOpenBridge.m */; };
0477BDF02EBB76E30055D639 /* HomeSheetVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0477BDEF2EBB76E30055D639 /* HomeSheetVC.m */; }; 0477BDF02EBB76E30055D639 /* HomeSheetVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 0477BDEF2EBB76E30055D639 /* HomeSheetVC.m */; };
0477BDF32EBB7B850055D639 /* KBDirectionIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0477BDF22EBB7B850055D639 /* KBDirectionIndicatorView.m */; }; 0477BDF32EBB7B850055D639 /* KBDirectionIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0477BDF22EBB7B850055D639 /* KBDirectionIndicatorView.m */; };
@@ -229,7 +229,7 @@
0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinCenterVC.m; 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>"; }; 0459D1B52EBA287900F2D189 /* KBSkinManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinManager.h; sourceTree = "<group>"; };
0459D1B62EBA287900F2D189 /* KBSkinManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinManager.m; sourceTree = "<group>"; }; 0459D1B62EBA287900F2D189 /* KBSkinManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinManager.m; sourceTree = "<group>"; };
0461310E2ECF0FBC00A6FADF /* fense.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = fense.zip; sourceTree = "<group>"; }; 046131102ECF3A6E00A6FADF /* fense.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = fense.zip; sourceTree = "<group>"; };
0477BD922EBAFF4E0055D639 /* KBURLOpenBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBURLOpenBridge.h; sourceTree = "<group>"; }; 0477BD922EBAFF4E0055D639 /* KBURLOpenBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBURLOpenBridge.h; sourceTree = "<group>"; };
0477BD932EBAFF4E0055D639 /* KBURLOpenBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBURLOpenBridge.m; sourceTree = "<group>"; }; 0477BD932EBAFF4E0055D639 /* KBURLOpenBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBURLOpenBridge.m; sourceTree = "<group>"; };
0477BDEE2EBB76E30055D639 /* HomeSheetVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeSheetVC.h; sourceTree = "<group>"; }; 0477BDEE2EBB76E30055D639 /* HomeSheetVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeSheetVC.h; sourceTree = "<group>"; };
@@ -484,7 +484,7 @@
children = ( children = (
041007D12ECE012000D203BB /* KBSkinIconMap.strings */, 041007D12ECE012000D203BB /* KBSkinIconMap.strings */,
041007D32ECE012500D203BB /* 002.zip */, 041007D32ECE012500D203BB /* 002.zip */,
0461310E2ECF0FBC00A6FADF /* fense.zip */, 046131102ECF3A6E00A6FADF /* fense.zip */,
); );
path = Resource; path = Resource;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -1425,7 +1425,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
04A9FE202EB893F10020DB6D /* Localizable.strings in Resources */, 04A9FE202EB893F10020DB6D /* Localizable.strings in Resources */,
0461310F2ECF0FBC00A6FADF /* fense.zip in Resources */, 046131112ECF3A6E00A6FADF /* fense.zip in Resources */,
041007D42ECE012500D203BB /* 002.zip in Resources */, 041007D42ECE012500D203BB /* 002.zip in Resources */,
041007D22ECE012000D203BB /* KBSkinIconMap.strings in Resources */, 041007D22ECE012000D203BB /* KBSkinIconMap.strings in Resources */,
04286A0B2ECD88B400CE730C /* KeyboardAssets.xcassets in Resources */, 04286A0B2ECD88B400CE730C /* KeyboardAssets.xcassets in Resources */,