@@ -910,7 +910,6 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
910
910
static CGPoint startPoint;
911
911
static CGRect originalFrame;
912
912
static BOOL dragging = NO ;
913
- static BOOL presenting = NO ;
914
913
915
914
__block UIView *keyboardView = [self .textInputbar.inputAccessoryView keyboardViewProxy ];
916
915
@@ -933,40 +932,32 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
933
932
startPoint = CGPointZero;
934
933
dragging = NO ;
935
934
936
- // Because the keyboard is on its own view hierarchy since iOS 9,
937
- // we instead show a snapshot of the keyboard and hide it
938
- // to give the illusion that the keyboard is being moved by the user.
939
- if (SLK_IS_IOS9_AND_HIGHER && gestureVelocity.y > 0 ) {
940
- [self .textInputbar showKeyboardMockup: YES ];
941
- }
942
-
943
935
break ;
944
936
}
945
937
case UIGestureRecognizerStateChanged: {
946
938
947
- if (CGRectContainsPoint (self.textInputbar .frame , gestureLocation) || dragging || presenting ){
939
+ if (CGRectContainsPoint (self.textInputbar .frame , gestureLocation) || dragging){
948
940
949
941
if (CGPointEqualToPoint (startPoint, CGPointZero)) {
950
942
startPoint = gestureLocation;
951
943
dragging = YES ;
952
944
953
- if (!presenting) {
954
- originalFrame = keyboardView.frame ;
945
+ // Because the keyboard is on its own view hierarchy since iOS 9,
946
+ // we instead show a snapshot of the keyboard and hide it
947
+ // to give the illusion that the keyboard is being moved by the user.
948
+ if (SLK_IS_IOS9_AND_HIGHER && gestureVelocity.y > 0 ) {
949
+ [self .textInputbar showKeyboardMockup: YES ];
955
950
}
951
+
952
+ originalFrame = keyboardView.frame ;
956
953
}
957
954
958
955
self.movingKeyboard = YES ;
959
956
960
957
CGPoint transition = CGPointMake (gestureLocation.x - startPoint.x , gestureLocation.y - startPoint.y );
961
958
962
959
CGRect keyboardFrame = originalFrame;
963
-
964
- if (presenting) {
965
- keyboardFrame.origin .y += transition.y ;
966
- }
967
- else {
968
- keyboardFrame.origin .y += MAX (transition.y , 0.0 );
969
- }
960
+ keyboardFrame.origin .y += MAX (transition.y , 0.0 );
970
961
971
962
// Makes sure they keyboard is always anchored to the bottom
972
963
if (CGRectGetMinY (keyboardFrame) < keyboardMinY) {
@@ -1014,18 +1005,13 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
1014
1005
}
1015
1006
1016
1007
CGPoint transition = CGPointMake (0.0 , fabs (gestureLocation.y - startPoint.y ));
1017
-
1018
1008
CGRect keyboardFrame = originalFrame;
1019
1009
1020
- if (presenting) {
1021
- keyboardFrame.origin .y = keyboardMinY;
1022
- }
1023
-
1024
1010
// The velocity can be changed to hide or show the keyboard based on the gesture
1025
1011
CGFloat minVelocity = 20.0 ;
1026
1012
CGFloat minDistance = CGRectGetHeight (keyboardFrame)/2.0 ;
1027
1013
1028
- BOOL hide = (gestureVelocity.y > minVelocity) || (presenting && transition. y < minDistance) || (!presenting && transition.y > minDistance);
1014
+ BOOL hide = (gestureVelocity.y > minVelocity) || (transition.y > minDistance);
1029
1015
1030
1016
if (hide) keyboardFrame.origin .y = keyboardMaxY;
1031
1017
@@ -1048,7 +1034,6 @@ - (void)slk_didPanTextInputBar:(UIPanGestureRecognizer *)gesture
1048
1034
startPoint = CGPointZero;
1049
1035
originalFrame = CGRectZero;
1050
1036
dragging = NO ;
1051
- presenting = NO ;
1052
1037
1053
1038
self.movingKeyboard = NO ;
1054
1039
0 commit comments