@@ -43,7 +43,7 @@ - (TPKeyboardAvoidingState*)keyboardAvoidingState {
4343
4444- (void )TPKeyboardAvoiding_keyboardWillShow : (NSNotification *)notification {
4545 CGRect keyboardRect = [self convertRect: [[[notification userInfo ] objectForKey: _UIKeyboardFrameEndUserInfoKey] CGRectValue ] fromView: nil ];
46- if (CGRectIsEmpty (keyboardRect)) {
46+ if (CGRectIsEmpty (keyboardRect) || ! CGRectIntersectsRect (keyboardRect, self. bounds ) ) {
4747 return ;
4848 }
4949
@@ -79,11 +79,16 @@ - (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification {
7979 self.contentSize = [self TPKeyboardAvoiding_calculatedContentSizeFromSubviewFrames ];
8080 }
8181 }
82-
82+ int curve = [[[notification userInfo ] objectForKey: UIKeyboardAnimationCurveUserInfoKey] intValue ];
83+ float duration = [[[notification userInfo ] objectForKey: UIKeyboardAnimationDurationUserInfoKey] floatValue ];
84+ if (curve == 0 )
85+ curve = 7 ;
86+ if (duration == 0 )
87+ duration = 0.25 ;
8388 // Shrink view's inset by the keyboard's height, and scroll to show the text field/view being edited
8489 [UIView beginAnimations: nil context: NULL ];
85- [UIView setAnimationCurve: [[[notification userInfo ] objectForKey: UIKeyboardAnimationCurveUserInfoKey] intValue ] ];
86- [UIView setAnimationDuration: [[[notification userInfo ] objectForKey: UIKeyboardAnimationDurationUserInfoKey] floatValue ] ];
90+ [UIView setAnimationCurve: curve ];
91+ [UIView setAnimationDuration: duration ];
8792
8893 self.contentInset = [self TPKeyboardAvoiding_contentInsetForKeyboard ];
8994
@@ -93,7 +98,7 @@ - (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification {
9398 [self setContentOffset: CGPointMake (self .contentOffset.x,
9499 [self TPKeyboardAvoiding_idealOffsetForView: firstResponder
95100 withViewingAreaHeight: viewableHeight])
96- animated: YES ];
101+ animated: NO ];
97102
98103
99104 [UIView commitAnimations ];
0 commit comments