3

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];
        });
    }
}
random
  • 8,568
  • 12
  • 50
  • 85
  • Is the condition being entered? Is the delegate method being called properly? – Mick MacCallum Feb 13 '14 at 20:40
  • @0x7fffffff Yes it is, I have a breakpoint set on the third line down and it is being reached. It's just doing `targetContentOffset->y = -50.0f;` has no effect – random Feb 13 '14 at 20:50

1 Answers1

0

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.

Community
  • 1
  • 1
cnotethegr8
  • 7,342
  • 8
  • 68
  • 104