1

我正在使用 TPKeyboardAvoidingScrollView 在键盘出现时向上移动视图。当我以正常速度返回键盘时,它工作得很好。但是当我以高于正常速度的速度返回键盘时。然后视图停留在顶部并且不会向下移动。

任何的想法?你们中有人见过这种问题吗?

任何帮助表示赞赏!

4

1 回答 1

1

我通过修改以下方法解决了这个问题。看看这里的区别。

前:

- (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];
}

后:

- (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;

}
于 2013-08-23T06:21:52.920 回答