2025-10-27 19:42:27 +08:00
|
|
|
|
//
|
|
|
|
|
|
// KBToolBar.h
|
|
|
|
|
|
// CustomKeyboard
|
|
|
|
|
|
//
|
2025-10-28 14:30:03 +08:00
|
|
|
|
// Created by Mac on 2025/10/28.
|
2025-10-27 19:42:27 +08:00
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
2025-10-28 10:18:10 +08:00
|
|
|
|
@class KBToolBar;
|
|
|
|
|
|
|
|
|
|
|
|
@protocol KBToolBarDelegate <NSObject>
|
|
|
|
|
|
@optional
|
2025-12-19 20:08:13 +08:00
|
|
|
|
/// 左侧功能按钮点击(index 从 0 开始)
|
2025-10-28 10:18:10 +08:00
|
|
|
|
- (void)toolBar:(KBToolBar *)toolBar didTapActionAtIndex:(NSInteger)index;
|
|
|
|
|
|
/// 右侧设置按钮点击
|
|
|
|
|
|
- (void)toolBarDidTapSettings:(KBToolBar *)toolBar;
|
2025-12-19 19:21:08 +08:00
|
|
|
|
/// 右侧撤销删除按钮点击
|
|
|
|
|
|
- (void)toolBarDidTapUndo:(KBToolBar *)toolBar;
|
2025-10-28 10:18:10 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
2025-12-19 20:08:13 +08:00
|
|
|
|
/// 顶部工具栏:左侧按钮数量可变,右侧为设置/撤销等功能区。
|
2025-10-27 19:42:27 +08:00
|
|
|
|
@interface KBToolBar : UIView
|
|
|
|
|
|
|
2025-10-28 10:18:10 +08:00
|
|
|
|
@property (nonatomic, weak, nullable) id<KBToolBarDelegate> delegate;
|
|
|
|
|
|
|
2025-12-19 21:36:11 +08:00
|
|
|
|
/// 左侧按钮的标题(数量由数组决定)。默认值:@[@"AI"]。
|
2025-10-28 10:18:10 +08:00
|
|
|
|
@property (nonatomic, copy) NSArray<NSString *> *leftButtonTitles;
|
|
|
|
|
|
|
|
|
|
|
|
/// 暴露按钮以便外部定制(只读;首次访问时懒加载创建)
|
|
|
|
|
|
@property (nonatomic, strong, readonly) NSArray<UIButton *> *leftButtons;
|
|
|
|
|
|
@property (nonatomic, strong, readonly) UIButton *settingsButton;
|
2025-12-19 19:21:08 +08:00
|
|
|
|
@property (nonatomic, strong, readonly) UIButton *undoButton;
|
2025-10-28 10:18:10 +08:00
|
|
|
|
|
2025-12-19 21:29:11 +08:00
|
|
|
|
/// 应用皮肤(更新 AI 按钮背景图)
|
|
|
|
|
|
- (void)kb_applyTheme;
|
|
|
|
|
|
|
2025-10-27 19:42:27 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|