Issue with TPKeyboardAvoidingScrollView

1.8k Views Asked by At

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!!

1

There are 1 best solutions below

0
Niru Mukund Shah On BEST ANSWER

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;

}