Skip to content

Commit

Permalink
QMUIKeyboardManager 错误修复
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoon committed Apr 26, 2017
1 parent 3809f3b commit 88f1be7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
4 changes: 0 additions & 4 deletions QMUIKit/UIComponents/QMUIKeyboardManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@
@end




@interface QMUIKeyboardUserInfo : NSObject

/**
Expand Down Expand Up @@ -173,8 +171,6 @@
@end




/**
* `QMUIKeyboardManagerDelegate`里面的方法是对应系统键盘通知的回调方法,具体请看delegate名字,`QMUIKeyboardUserInfo`是对系统的userInfo做了一个封装,可以方便的获取userInfo的属性值。
*/
Expand Down
22 changes: 3 additions & 19 deletions QMUIKit/UIComponents/QMUIKeyboardManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,10 @@ - (void)keyboardDidHideNotification:(NSNotification *)notification {
}

// 额外处理iPad浮动键盘
if (kCurrentResponder) {
if (IS_IPAD) {
if (self.targetResponderValues.count <= 0 || kCurrentResponder) {
self.keyboardMoveUserInfo = userInfo;
[self keyboardDidChangedFrame:[self.class keyboardView]];
} else {
if (!kCurrentResponder.km_isFirstResponder) {
kCurrentResponder = nil;
}
}
}
}
Expand Down Expand Up @@ -513,18 +508,7 @@ - (BOOL)shouldReceiveShowNotification {
if (self.targetResponderValues.count <= 0) {
return YES;
} else {
id firstResponder = [[UIApplication sharedApplication].keyWindow km_findFirstResponder];
return kCurrentResponder && [self.targetResponderValues containsObject:[self packageTargetResponder:kCurrentResponder]];
kCurrentResponder = firstResponder;
NSInteger fromIndex = [self.targetResponderValues indexOfObject:[self packageTargetResponder:firstResponder]];
NSInteger toIndex = self.targetResponderValues.count - 1;
if (fromIndex != toIndex) {
[self.targetResponderValues exchangeObjectAtIndex:fromIndex withObjectAtIndex:toIndex];
}
return YES;
} else {
return NO;
}
}
}

Expand Down Expand Up @@ -578,14 +562,14 @@ - (void)keyboardDidChangedFrame:(UIView *)keyboardView {
// 第一次需要初始化
self.keyboardMoveBeginRect = CGRectMake(0, keyboardWindow.bounds.size.height, keyboardWindow.bounds.size.width, 0);
}

CGRect endFrame = CGRectZero;
if (keyboardWindow) {
endFrame = [keyboardWindow convertRect:keyboardView.frame toWindow:nil];
} else {
endFrame = keyboardView.frame;
}

// 自己构造一个QMUIKeyboardUserInfo,一些属性使用之前最后一个keyboardUserInfo的值
QMUIKeyboardUserInfo *keyboardMoveUserInfo = [[QMUIKeyboardUserInfo alloc] init];
keyboardMoveUserInfo.keyboardManager = self;
Expand Down Expand Up @@ -668,7 +652,7 @@ + (UIWindow *)keyboardWindow {
return window;
}
}

NSMutableArray *kbWindows = nil;

for (UIWindow *window in [UIApplication sharedApplication].windows) {
Expand Down

0 comments on commit 88f1be7

Please sign in to comment.