添加功能组件

This commit is contained in:
2025-10-28 15:18:12 +08:00
parent 2f2f20cfc2
commit a2b51189aa
4 changed files with 60 additions and 13 deletions

View File

@@ -14,7 +14,7 @@
static CGFloat KEYBOARDHEIGHT = 256;
@interface KeyboardViewController () <KBKeyBoardMainViewDelegate>
@interface KeyboardViewController () <KBKeyBoardMainViewDelegate, KBFunctionViewDelegate>
@property (nonatomic, strong) UIButton *nextKeyboardButton; //
@property (nonatomic, strong) KBKeyBoardMainView *keyBoardMainView; // 0
@property (nonatomic, strong) KBFunctionView *functionView; // 0
@@ -22,11 +22,6 @@ static CGFloat KEYBOARDHEIGHT = 256;
@implementation KeyboardViewController
- (void)updateViewConstraints {
[super updateViewConstraints];
//
}
- (void)viewDidLoad {
[super viewDidLoad];
@@ -46,7 +41,6 @@ static CGFloat KEYBOARDHEIGHT = 256;
make.bottom.equalTo(self.view.mas_bottom).offset(-4);
}];
self.keyBoardMainView.delegate = self;
[self.view addSubview:self.keyBoardMainView];
[self.keyBoardMainView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
@@ -64,7 +58,7 @@ static CGFloat KEYBOARDHEIGHT = 256;
//
self.functionView.hidden = !show;
self.keyBoardMainView.hidden = show;
//
if (show) {
[self.view bringSubviewToFront:self.functionView];
@@ -76,7 +70,6 @@ static CGFloat KEYBOARDHEIGHT = 256;
// MARK: - KBKeyBoardMainViewDelegate
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didTapKey:(KBKey *)key {
switch (key.type) {
case KBKeyTypeCharacter:
@@ -99,7 +92,6 @@ static CGFloat KEYBOARDHEIGHT = 256;
}
- (void)keyBoardMainView:(KBKeyBoardMainView *)keyBoardMainView didTapToolActionAtIndex:(NSInteger)index {
//
if (index == 0) {
[self showFunctionPanel:YES];
} else {
@@ -107,10 +99,19 @@ static CGFloat KEYBOARDHEIGHT = 256;
}
}
// MARK: - KBFunctionViewDelegate
- (void)functionView:(KBFunctionView *)functionView didTapToolActionAtIndex:(NSInteger)index {
// index == 0
if (index == 0) {
[self showFunctionPanel:NO];
}
}
#pragma mark - lazy
- (KBKeyBoardMainView *)keyBoardMainView{
if (!_keyBoardMainView) {
_keyBoardMainView = [[KBKeyBoardMainView alloc] init];
_keyBoardMainView.delegate = self;
}
return _keyBoardMainView;
}
@@ -118,10 +119,12 @@ static CGFloat KEYBOARDHEIGHT = 256;
- (KBFunctionView *)functionView{
if (!_functionView) {
_functionView = [[KBFunctionView alloc] init];
_functionView.delegate = self; // Bar
}
return _functionView;
}
@end