37 lines
991 B
Objective-C
37 lines
991 B
Objective-C
//
|
||
// KBToolBar.h
|
||
// CustomKeyboard
|
||
//
|
||
// Created by Mac on 2025/10/27.
|
||
//
|
||
|
||
#import <UIKit/UIKit.h>
|
||
|
||
NS_ASSUME_NONNULL_BEGIN
|
||
|
||
@class KBToolBar;
|
||
|
||
@protocol KBToolBarDelegate <NSObject>
|
||
@optional
|
||
/// 左侧 4 个功能按钮点击(index: 0~3)
|
||
- (void)toolBar:(KBToolBar *)toolBar didTapActionAtIndex:(NSInteger)index;
|
||
/// 右侧设置按钮点击
|
||
- (void)toolBarDidTapSettings:(KBToolBar *)toolBar;
|
||
@end
|
||
|
||
/// 顶部工具栏:左侧 4 个按钮,右侧 1 个设置按钮。
|
||
@interface KBToolBar : UIView
|
||
|
||
@property (nonatomic, weak, nullable) id<KBToolBarDelegate> delegate;
|
||
|
||
/// 左侧 4 个按钮的标题。默认值:@[@"Item1", @"Item2", @"Item3", @"Item4"]。
|
||
@property (nonatomic, copy) NSArray<NSString *> *leftButtonTitles;
|
||
|
||
/// 暴露按钮以便外部定制(只读;首次访问时懒加载创建)
|
||
@property (nonatomic, strong, readonly) NSArray<UIButton *> *leftButtons;
|
||
@property (nonatomic, strong, readonly) UIButton *settingsButton;
|
||
|
||
@end
|
||
|
||
NS_ASSUME_NONNULL_END
|