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];
});
}
}
This seems to be your answer.
Theres a UIScrollView
bug with setting the targetContentOffset
of scrollViewWillEndDragging:withVelocity:targetContentOffset:
while the scroll view is at it's default content offset.