修改键盘UI
This commit is contained in:
@@ -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.
@@ -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:
|
||||||
// 主要作用于字母布局第三行左右两侧的两个键,避免被挤压导致图标变形。
|
// - 第三行:Shift、Backspace
|
||||||
if (b.key.type == KBKeyTypeShift || b.key.type == KBKeyTypeBackspace) {
|
// - 第四行:123/ABC(ModeChange)、#+=(SymbolsToggle)、AI(Custom)
|
||||||
|
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、#+=、AI:宽度与基准键一致(1 倍,“接近正方形”)
|
|
||||||
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) {
|
||||||
|
|||||||
@@ -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 */,
|
||||||
|
|||||||
Reference in New Issue
Block a user