处理键盘闪的问题

This commit is contained in:
2026-02-10 18:53:31 +08:00
parent 3c71797b7b
commit 02323fb5f1
2 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"WebSearch",
"Bash(git checkout:*)"
]
}
}

View File

@@ -197,6 +197,14 @@ static NSString *KBFormatMB(uint64_t bytes) {
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
// FIX: iOS 26
// setupUI 0
//
CGFloat portraitWidth = [self kb_portraitWidth];
CGFloat keyboardHeight = [self kb_keyboardHeightForWidth:portraitWidth];
if (self.kb_heightConstraint) {
self.kb_heightConstraint.constant = keyboardHeight;
}
// / // /
[[KBBackspaceUndoManager shared] registerNonClearAction]; [[KBBackspaceUndoManager shared] registerNonClearAction];
[[KBInputBufferManager shared] resetWithText:@""]; [[KBInputBufferManager shared] resetWithText:@""];
@@ -263,8 +271,15 @@ static NSString *KBFormatMB(uint64_t bytes) {
CGFloat keyboardBaseHeight = [self kb_keyboardBaseHeightForWidth:portraitWidth]; CGFloat keyboardBaseHeight = [self kb_keyboardBaseHeightForWidth:portraitWidth];
CGFloat screenWidth = CGRectGetWidth([UIScreen mainScreen].bounds); CGFloat screenWidth = CGRectGetWidth([UIScreen mainScreen].bounds);
// FIX: iOS 26
// iOS 26 self.view view
// view
// UI
// 0
// viewWillAppear:
// iOS 18
NSLayoutConstraint *h = NSLayoutConstraint *h =
[self.view.heightAnchor constraintEqualToConstant:keyboardHeight]; [self.view.heightAnchor constraintEqualToConstant:0];
NSLayoutConstraint *w = NSLayoutConstraint *w =
[self.view.widthAnchor constraintEqualToConstant:screenWidth]; [self.view.widthAnchor constraintEqualToConstant:screenWidth];
self.kb_heightConstraint = h; self.kb_heightConstraint = h;