@@ -892,6 +892,32 @@ - (void)setTextInputbarHidden:(BOOL)hidden animated:(BOOL)animated
892
892
}
893
893
}
894
894
895
+ - (void )dismissTextInputbar : (BOOL )animated
896
+ {
897
+ if (self.keyboardHC .constant == 0 ) {
898
+ return ;
899
+ }
900
+
901
+ __weak typeof (self) weakSelf = self;
902
+
903
+ [self slk_hideAutoCompletionViewIfNeeded ];
904
+
905
+ void (^animations)() = ^void (){
906
+
907
+ weakSelf.keyboardHC .constant = 0.0 ;
908
+ weakSelf.scrollViewHC .constant = [weakSelf slk_appropriateScrollViewHeight ];
909
+
910
+ [weakSelf.view layoutIfNeeded ];
911
+ };
912
+
913
+ if (animated) {
914
+ [UIView animateWithDuration: 0.25 animations: animations completion: nil ];
915
+ }
916
+ else {
917
+ animations ();
918
+ }
919
+ }
920
+
895
921
896
922
#pragma mark - Private Methods
897
923
@@ -1160,20 +1186,6 @@ - (void)slk_enableTypingSuggestionIfNeeded
1160
1186
[self .textView setTypingSuggestionEnabled: enable];
1161
1187
}
1162
1188
1163
- - (void )slk_dismissTextInputbarIfNeeded
1164
- {
1165
- if (self.keyboardHC .constant == 0 ) {
1166
- return ;
1167
- }
1168
-
1169
- self.keyboardHC .constant = 0.0 ;
1170
- self.scrollViewHC .constant = [self slk_appropriateScrollViewHeight ];
1171
-
1172
- [self slk_hideAutoCompletionViewIfNeeded ];
1173
-
1174
- [self .view layoutIfNeeded ];
1175
- }
1176
-
1177
1189
- (void )slk_detectKeyboardStatesInNotification : (NSNotification *)notification
1178
1190
{
1179
1191
// Tear down
@@ -1343,7 +1355,7 @@ - (void)slk_willShowOrHideKeyboard:(NSNotification *)notification
1343
1355
return ;
1344
1356
}
1345
1357
else if (![self forceTextInputbarAdjustmentForResponder: currentResponder]) {
1346
- return [self slk_dismissTextInputbarIfNeeded ];
1358
+ return [self dismissTextInputbar: NO ];
1347
1359
}
1348
1360
}
1349
1361
0 commit comments