`willScrollToDateSegmentWith` is not called when scrolling back to the first page (page 0)
(Required) Version Number: 8.0.2
Description
When implementing the willScrollToDateSegmentWith delegate function, it is not called when scrolling back to the first page.
Steps To Reproduce
- Create a calendar with scrolling mode of
.stopAtEachSection - implement the
willScrollToDateSegmentWithdelegate function - Scroll to page 1
- Scroll back to page 0
Notice, willScrollToDateSegmentWith is not called.
Expected Behavior
willScrollToDateSegmentWith should be called when scrolling back to page 0.
will look into this
I have this same issue
I have the same issue. still now. Anyone ?
I have the same issue and the problem seems to be caused by:
Here you computed theCurrentContentOffset with scrollView's contentOffset, and let's say it gives 1450 when scrolling to the last segment.
Then maxContentOffset is computed using scrollView.contentSize.width - scrollView.frame.width, which, might also be 1450. And here we return because we thought the user has scrolled beyond the border, even if he/she didn't.
Normally, a user might not scroll to exactly the end of the segment, 1450 in our example. But when a scroll is interrupted by view popping and pushing, UIKit manually scrolls the view to targetContentOffset, which might gives us a case where:
- User scrolled to 1400, which is fine. Then he/she pressed a button to navigate to another view
- UIKit would call
scrollViewWillEndDraggingin this case and with ascrollViewwhosecontentOffsetis 1450
Instead I think you should just remove the two = signs here
if theCurrentContentOffset >= maxContentOffset { setTargetContentOffset(maxContentOffset) ; return }
if theCurrentContentOffset <= 0 { setTargetContentOffset(0); return }
Or maybe we should just remove the two returns here?
Even if a user scrolls beyond the border, we should still get a willScrollToDateSegmentWith call back. But that's just my thoughts.
So the user can still get a willScrollToDateSegmentWith call back when he navigates around and UIKit decides he scrolled to another location.