|
|
@@ -87,10 +87,12 @@
|
|
|
|
|
|
/**在使用过程中切换键盘*/
|
|
|
- (void)keyboardChangeFrame:(NSNotification *)notification {
|
|
|
+
|
|
|
+ CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
|
|
|
+ CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
|
|
+
|
|
|
// 在屏幕旋转时也会走这个方法,但是此时键盘会 hide -> show -> changeFrame
|
|
|
if (self.showsKeyboard) {
|
|
|
- CGRect begin = [[[notification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
|
|
|
- CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
|
|
|
|
|
|
// 在ip6s中使用搜狗输入法和系统键盘切换时发现
|
|
|
// sougou --> sys : 282 -> 258
|
|
|
@@ -105,9 +107,21 @@
|
|
|
[self.delegate keyboardWillChangeHeight:self.keyboardHeight offset:offset withDuration:changeFrameAnimationDuartion];
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
|
|
|
+ // ios11 键盘通知改变。Show Keyboard调用
|
|
|
+ if (end.origin.y < begin.origin.y) {
|
|
|
+ self.showsKeyboard = YES;
|
|
|
+ CGFloat offset = end.size.height - begin.size.height;
|
|
|
+ self.keyboardHeight = end.size.height;
|
|
|
+ if (self.delegate && [self.delegate respondsToSelector:@selector(keyboardWillChangeHeight:offset:withDuration:)]) {
|
|
|
+ [self.delegate keyboardWillChangeHeight:self.keyboardHeight offset:offset withDuration:self.keyboardAnimationDuration];
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#pragma mark - Getter
|