AI键移除 放在顶部KBToolBar

This commit is contained in:
2025-12-19 20:08:13 +08:00
parent 7587fe6714
commit 70520fb7d9
5 changed files with 19 additions and 23 deletions

View File

@@ -277,10 +277,6 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:@"123"
output:@""
type:KBKeyTypeModeChange];
KBKey *customAI = [KBKey keyWithIdentifier:@"ai"
title:@"AI"
output:@""
type:KBKeyTypeCustom];
KBKey *emoji = [KBKey keyWithIdentifier:KBKeyIdentifierEmojiPanel
title:@"😊"
output:@""
@@ -293,7 +289,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:KBLocalized(@"Send")
output:@"\n"
type:KBKeyTypeReturn];
return @[ mode123, customAI, emoji, space, ret ];
return @[ mode123, emoji, space, ret ];
}
//
@@ -302,10 +298,6 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:@"abc"
output:@""
type:KBKeyTypeModeChange];
KBKey *customAI = [KBKey keyWithIdentifier:@"ai"
title:@"AI"
output:@""
type:KBKeyTypeCustom];
KBKey *emoji = [KBKey keyWithIdentifier:KBKeyIdentifierEmojiPanel
title:@"😊"
output:@""
@@ -318,7 +310,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
title:KBLocalized(@"Send")
output:@"\n"
type:KBKeyTypeReturn];
return @[ modeABC, customAI, emoji, space, ret ];
return @[ modeABC, emoji, space, ret ];
}
#pragma mark - Row Building
@@ -332,7 +324,7 @@ static const CGFloat kKBLettersRow2EdgeSpacerMultiplier = 0.5;
edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
// 4 使
// 123/ABCAISend Space
// 123/ABCEmojiSend Space
BOOL isBottomControlRow = [self kb_isBottomControlRowWithKeys:keys];
CGFloat spacing = 0; //
@@ -419,7 +411,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
}];
}
// 123/ABCAISend
// 123/ABCEmojiSend
// Space
if (isBottomControlRow) {
[self kb_applyBottomControlRowWidthInRow:row];
@@ -448,7 +440,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
}
}
if (firstChar) {
// 123/ABC/AI/#+=
// 123/ABC/#+=
// 1:1 123/ABC
if (!hasCharacterInRow &&
(firstChar.key.type == KBKeyTypeModeChange ||
@@ -540,7 +532,7 @@ edgeSpacerMultiplier:(CGFloat)edgeSpacerMultiplier {
}
//
// - 123/ABCAI = * multiplier
// - 123/ABCEmoji = * multiplier
// - Send = 2
// - Space
- (void)kb_applyBottomControlRowWidthInRow:(UIView *)row {

View File

@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol KBToolBarDelegate <NSObject>
@optional
/// 左侧 4 个功能按钮点击index: 0~3
/// 左侧功能按钮点击index 从 0 开始
- (void)toolBar:(KBToolBar *)toolBar didTapActionAtIndex:(NSInteger)index;
/// 右侧设置按钮点击
- (void)toolBarDidTapSettings:(KBToolBar *)toolBar;
@@ -21,12 +21,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)toolBarDidTapUndo:(KBToolBar *)toolBar;
@end
/// 顶部工具栏:左侧 4 个按钮,右侧 1 个设置按钮
/// 顶部工具栏:左侧按钮数量可变,右侧为设置/撤销等功能区
@interface KBToolBar : UIView
@property (nonatomic, weak, nullable) id<KBToolBarDelegate> delegate;
/// 左侧 4 个按钮的标题。默认值:@[@"Item1", @"Item2", @"Item3", @"Item4"]。
/// 左侧按钮的标题(数量由数组决定)。默认值:@[@"Recharge Now", @"AI"]。
@property (nonatomic, copy) NSArray<NSString *> *leftButtonTitles;
/// 暴露按钮以便外部定制(只读;首次访问时懒加载创建)

View File

@@ -24,7 +24,7 @@
- (instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
self.backgroundColor = [UIColor clearColor];
_leftButtonTitles = @[KBLocalized(@"Recharge Now")]; //
_leftButtonTitles = @[KBLocalized(@"Recharge Now"), @"AI"]; //
[self setupUI];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(kb_undoStateChanged)