UIScrollView setContentInset calls scroll scrolling in ios8

I had a problem creating a pull mechanism for updating at the bottom of the scroll. The code works perfectly smoothly in iOS7, but in iOS8 scrollview jumps instantly and then animates to the correct position.

I keep track of the scroll until it is full of rubber outside of kPullToRefreshHeightPX (in my case it is 40px) and set the flag to be inserted into release and start updating the content.

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (_webShouldInsetScrollView == NO && (scrollView.contentOffset.y > ((scrollView.contentSize.height - scrollView.frame.size.height) + kPullToRefreshHeightPX)))
    {
        _webShouldInsetScrollView = YES;
    }
}

If we pulled the drag out of our update distance at the end, we insert (and run our small update animation) and show the next page of results.

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    if (_webShouldInsetScrollView)
    {
        [UIView animateWithDuration:0.2 animations:^{
                [scrollView setContentInset:UIEdgeInsetsMake(0.0f, 0.0f, kPullToRefreshHeightPX, 0.0f)];
        } completion:^(BOOL finished) {
        }];

        [self performSelector:@selector(showNextResultsPage) withObject:nil afterDelay:1.0f];
    }
}

UIScrollViews iOS8, automaticallyAdjustsScrollViewInsets, false iOS7, true iOS8, . - ?

+4
3

: D

CGPoint offset = scrollView.contentOffset;
[scrollView setContentInset:UIEdgeInsetsMake(topInset, 0, 0, 0)];
scrollView.contentOffset = offset;
+7

...

, - โ€‹โ€‹-:

, View 200 500 - scrollViewDidEndDragging :

 [UIView animateWithDuration:0.2
                          delay:0
                        options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState
                     animations:^{
                         scrollView.contentInset = targetInset;
                     }
                     completion:nil];

    [self sendActionsForControlEvents:UIControlEventValueChanged];

, 500 -let say-250, targetValue (250) , ...

. reset ... targetValue , :

_isAnimatingInset = YES;
_currentTopInsetTarget = targetInset.top;

 [UIView animateWithDuration:0.2
                          delay:0
                        options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState
                     animations:^{
                         scrollView.contentInset = targetInset;
                     }
                     completion:^(BOOL finished) {
                         //Workaround for a iOS8-Bug see property-comment for further infos
                         _isAnimatingInset = NO;
                         scrollView.contentInset = targetInset;
                     }];

    [self sendActionsForControlEvents:UIControlEventValueChanged];

, , , ( reset , hickUp ...)

+1

. , pull-to-referh github ( iOS8-), , iOS8.

, . : , contentInset scrollView. Inset ( iOS7, iOS8), iOS8 .

. startRefresh pull-to-refres. - UIView animateWithDuration:0.2 animations scrollViewDidEndDragging.

- scrollViewDidScroll ( ):

if (self.isRefreshing) {
    // If we already scrolled back past the point of our control height and we haven't changed
    // contentInset yet - update it

    if (scrollView.contentOffset.y > -CONTROL_HEIGHT && scrollView.contentInset.top == 0) {
        UIEdgeInsets inset = scrollView.contentInset;
        inset.top = CONTROL_HEIGHT;
        scrollView.contentInset = inset;
    }
    return;
}

... 
0