@@ -892,32 +892,6 @@ - (void)setTextInputbarHidden:(BOOL)hidden animated:(BOOL)animated
892892 }
893893}
894894
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-
921895
922896#pragma mark - Private Methods
923897
@@ -1186,6 +1160,20 @@ - (void)slk_enableTypingSuggestionIfNeeded
11861160 [self .textView setTypingSuggestionEnabled: enable];
11871161}
11881162
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+
11891177- (void )slk_detectKeyboardStatesInNotification : (NSNotification *)notification
11901178{
11911179 // Tear down
@@ -1355,7 +1343,7 @@ - (void)slk_willShowOrHideKeyboard:(NSNotification *)notification
13551343 return ;
13561344 }
13571345 else if (![self forceTextInputbarAdjustmentForResponder: currentResponder]) {
1358- return [self dismissTextInputbar: NO ];
1346+ return [self slk_dismissTextInputbarIfNeeded ];
13591347 }
13601348 }
13611349
0 commit comments