@@ -931,9 +931,7 @@ - (void)dismissTextInputbarIfNeeded
931
931
self.keyboardHC .constant = 0.0 ;
932
932
self.scrollViewHC .constant = [self appropriateScrollViewHeight ];
933
933
934
- if (self.isAutoCompleting ) {
935
- [self hideAutoCompletionView ];
936
- }
934
+ [self hideAutoCompletionViewIfNeeded ];
937
935
938
936
// Forces the keyboard status change
939
937
[self updateKeyboardStatus: SLKKeyboardStatusDidHide];
@@ -1086,9 +1084,9 @@ - (void)willShowOrHideKeyboard:(NSNotification *)notification
1086
1084
self.keyboardHC .constant = [self appropriateKeyboardHeight: notification];
1087
1085
self.scrollViewHC .constant = [self appropriateScrollViewHeight ];
1088
1086
1089
- // Hides autocompletion mode if the keyboard is being dismissed
1090
- if (( ![self .textView isFirstResponder ] || status == SLKKeyboardStatusWillHide) && self. isAutoCompleting ) {
1091
- [self hideAutoCompletionView ];
1087
+ // Hides the autocompletion view if the keyboard is being dismissed
1088
+ if (![self .textView isFirstResponder ] || status == SLKKeyboardStatusWillHide) {
1089
+ [self hideAutoCompletionViewIfNeeded ];
1092
1090
}
1093
1091
1094
1092
// Only for this animation, we set bo to bounce since we want to give the impression that the text input is glued to the keyboard.
@@ -1300,6 +1298,10 @@ - (void)registerPrefixesForAutoCompletion:(NSArray *)prefixes
1300
1298
1301
1299
- (void )processTextForAutoCompletion
1302
1300
{
1301
+ if (self.isRotating ) {
1302
+ return ;
1303
+ }
1304
+
1303
1305
// Avoids text processing for autocompletion if the registered prefix list is empty.
1304
1306
if (self.registeredPrefixes .count == 0 ) {
1305
1307
return ;
@@ -1385,9 +1387,7 @@ - (void)cancelAutoCompletion
1385
1387
1386
1388
[self .autoCompletionView setContentOffset: CGPointZero ];
1387
1389
1388
- if (self.isAutoCompleting ) {
1389
- [self showAutoCompletionView: NO ];
1390
- }
1390
+ [self hideAutoCompletionViewIfNeeded ];
1391
1391
}
1392
1392
1393
1393
- (void )acceptAutoCompletionWithString : (NSString *)string
@@ -1408,13 +1408,20 @@ - (void)acceptAutoCompletionWithString:(NSString *)string
1408
1408
[textView slk_scrollToCaretPositonAnimated: NO ];
1409
1409
}
1410
1410
1411
- - (void )hideAutoCompletionView
1411
+ - (void )hideAutoCompletionViewIfNeeded
1412
1412
{
1413
- [self showAutoCompletionView: NO ];
1413
+ if (self.isAutoCompleting ) {
1414
+ [self showAutoCompletionView: NO ];
1415
+ }
1414
1416
}
1415
1417
1416
1418
- (void )showAutoCompletionView : (BOOL )show
1417
1419
{
1420
+ // Skips if rotating
1421
+ if (self.isRotating ) {
1422
+ return ;
1423
+ }
1424
+
1418
1425
CGFloat viewHeight = show ? [self heightForAutoCompletionView ] : 0.0 ;
1419
1426
1420
1427
if (self.autoCompletionViewHC .constant == viewHeight) {
@@ -1806,7 +1813,10 @@ - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrie
1806
1813
1807
1814
- (void )didRotateFromInterfaceOrientation : (UIInterfaceOrientation)fromInterfaceOrientation
1808
1815
{
1809
- self.rotating = NO ;
1816
+ // Delays the rotation flag
1817
+ dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
1818
+ self.rotating = NO ;
1819
+ });
1810
1820
}
1811
1821
1812
1822
- (NSUInteger )supportedInterfaceOrientations
0 commit comments