-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trigger willScrollToDateSegmentWith when scrolling programmatically with scrollToSegment #1327
base: master
Are you sure you want to change the base?
Conversation
When the user scrolled to a segment programmatically with scrollToSegment then the willScrollToDateSegmentWith delegate did not get called. This change fixes this and calls the delegate function at the right time.
You need to fix merge conflicts :) |
@@ -356,7 +356,7 @@ | |||
CLANG_ENABLE_MODULES = YES; | |||
CODE_SIGN_STYLE = Automatic; | |||
DEFINES_MODULE = YES; | |||
DEVELOPMENT_TEAM = GBBYECNDQ9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need
@@ -384,7 +384,7 @@ | |||
CLANG_ENABLE_MODULES = YES; | |||
CODE_SIGN_STYLE = Automatic; | |||
DEFINES_MODULE = YES; | |||
DEVELOPMENT_TEAM = GBBYECNDQ9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need
// This was needed for when the user scrolls to next segment which will be the last, | ||
// then the value is not exact the same as the height of the content, | ||
// and then the didScrollToSegment delegate got called before the scroll happened, this fixed it. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line
|
||
// If we added maybe too much days we check if we are in the range of the calendar | ||
// if we gone too far we just use the endDate of the Calendar | ||
if correctedNextDate < endDateCache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can change to:
date = correctedNextDate < endDateCache ? correctedNextDate : endDateCache
This PR is a fix and a followup on #1262
My problem was that when I programmatically scrolled the calendar with the function scrollToSegment, then the willScrollToDateSegmentWith delegate did not get called.
I wanted this delegate to work because i wanted to deselect all dates before the scroll did end. I searched for an answer and found the PR #1264 which made the delegate work when the user scrolled with dragging the scrollview. But it did not fix my issue. So i forked his solution and added my fix.
So this PR fixes the willScrollToDateSegmentWith delegate. Now it will get called whenever you scroll via dragging the scrollview, or programmatically using scrollToSegment.