@@ -44,7 +44,7 @@ - (TPKeyboardAvoidingState*)keyboardAvoidingState {
4444
4545- (void )TPKeyboardAvoiding_keyboardWillShow : (NSNotification *)notification {
4646 CGRect keyboardRect = [self convertRect: [[[notification userInfo ] objectForKey: _UIKeyboardFrameEndUserInfoKey] CGRectValue ] fromView: nil ];
47- if (CGRectIsEmpty (keyboardRect)) {
47+ if (CGRectIsEmpty (keyboardRect) || ! CGRectIntersectsRect (keyboardRect, self. bounds ) ) {
4848 return ;
4949 }
5050
@@ -76,11 +76,16 @@ - (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification {
7676 self.contentSize = [self TPKeyboardAvoiding_calculatedContentSizeFromSubviewFrames ];
7777 }
7878 }
79-
79+ int curve = [[[notification userInfo ] objectForKey: UIKeyboardAnimationCurveUserInfoKey] intValue ];
80+ float duration = [[[notification userInfo ] objectForKey: UIKeyboardAnimationDurationUserInfoKey] floatValue ];
81+ if (curve == 0 )
82+ curve = 7 ;
83+ if (duration == 0 )
84+ duration = 0.25 ;
8085 // Shrink view's inset by the keyboard's height, and scroll to show the text field/view being edited
8186 [UIView beginAnimations: nil context: NULL ];
82- [UIView setAnimationCurve: [[[notification userInfo ] objectForKey: UIKeyboardAnimationCurveUserInfoKey] intValue ] ];
83- [UIView setAnimationDuration: [[[notification userInfo ] objectForKey: UIKeyboardAnimationDurationUserInfoKey] floatValue ] ];
87+ [UIView setAnimationCurve: curve ];
88+ [UIView setAnimationDuration: duration ];
8489
8590 self.contentInset = [self TPKeyboardAvoiding_contentInsetForKeyboard ];
8691
@@ -90,7 +95,7 @@ - (void)TPKeyboardAvoiding_keyboardWillShow:(NSNotification*)notification {
9095 [self setContentOffset: CGPointMake (self .contentOffset.x,
9196 [self TPKeyboardAvoiding_idealOffsetForView: firstResponder
9297 withViewingAreaHeight: viewableHeight])
93- animated: YES ];
98+ animated: NO ];
9499
95100
96101 [UIView commitAnimations ];
0 commit comments