Pergunta

Why is this not working? I have a breakpoint set at targetContentOffset->y = -50.0f; and it is being hit, not sure why it's not having any effect.

Yes paging = NO.

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
    if (scrollView.contentOffset.y < -50.0f) {
        targetContentOffset->y = -50.0f;
    }
    else {
        *targetContentOffset = CGPointZero;

        // Need to call this subsequently to remove flickering.
        dispatch_async(dispatch_get_main_queue(), ^{
            [scrollView setContentOffset:CGPointZero animated:YES];
        });
    }
}
Foi útil?

Solução

This seems to be your answer.

scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView

Theres a UIScrollView bug with setting the targetContentOffset of scrollViewWillEndDragging:withVelocity:targetContentOffset: while the scroll view is at it's default content offset.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top