1

I'm using TPKeyboardAvoidingScrollView for moving view up when keyboard appears. It is working perfectly when I return my keyboard in a normal speed. But when I return the keyboard with the speed higher than normal. Then the view stuck to the top and doesn't move down.

Any idea? Any of you have seen this kind of problem before?

Any help is appreciated!!

Niru Mukund Shah
  • 4,637
  • 2
  • 20
  • 34

1 Answers1

1

I solved the problem by modifying following method. Take a look at the difference here.

Before:

- (void)keyboardWillHide:(NSNotification*)notification
{
    _keyboardRect = CGRectZero;
    _keyboardVisible = NO;

    // Restore dimensions to prior size
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
    [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];

    self.contentInset = _priorInset;

    [self setScrollIndicatorInsets:self.contentInset];
    _priorInsetSaved = NO;

    [UIView commitAnimations];
}

After:

- (void)keyboardWillHide:(NSNotification*)notification
{
    _keyboardRect = CGRectZero;

    // Restore dimensions to prior size
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]];
    [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]];

    self.contentInset = _priorInset;

    [self setScrollIndicatorInsets:self.contentInset];
    _priorInsetSaved = NO;

    [self adjustOffsetToIdealIfNeeded];

    [UIView commitAnimations];

    _keyboardVisible = NO;

}
Niru Mukund Shah
  • 4,637
  • 2
  • 20
  • 34