Skip to content
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

lastSavedContentOffset not set on programmatic scroll #276

Conversation

KyleConway
Copy link
Contributor

When using scrollToDate(...) or scrollToHeaderForDate(...) on a JTAppleCalendarViewCalendar, the initial value of lastSavedContentOffset remains 0 even when scroll animation has finished. As a result, the isScrollingForward flag within scrollViewWillEndDragging of UIScrollViewDelegate is being set incorrectly. This results in the calendar view bouncing back to its initial position on the first time the user scrolls to a previous month. It is 100% reproducible. On the next scroll attempt, the user is able to scroll correctly because the lastSavedContentOffset has been updated. It is the initial value of lastSavedContentOffset that needs to be calculated correctly after programmatic scroll.

…nt offset was not being set. This would result in the calendar view boucning back down if scrolling up to previous month when using a vertically enabled jtcalendar
@patchthecode
Copy link
Owner

Awesome nice find. Looking into it. Will approve this after i test it.
Thanks.

@KyleConway
Copy link
Contributor Author

KyleConway commented Jan 30, 2017

Thanks @patchthecode for the quick response - I should mention the use case for how I found this issue.

I have created a vertically enabled JTAppleCalendarView instance and I'm setting a starting date for the calendar to be a year prior to the current date and the ending date to be a year after. I am presenting my container controller as a modal and I want the calendar to open to the current date i.e. today.

Within viewWillAppear of my container controller, I am calling scrollToDate(...) on my instance of JTAppleCalendarView. Once opened, try to scroll to the previous month and it will bounce back to the original month every time.

After that it will work - only initially is the interaction failing for the previously mentioned reasons. I should also mention that scrolling mode = .stopAtEachSection too. Hope this helps - let me know if you need any more info.

@patchthecode patchthecode self-assigned this Jan 30, 2017
@patchthecode patchthecode merged commit 6d417ec into patchthecode:master Jan 31, 2017
@patchthecode
Copy link
Owner

patchthecode commented Jan 31, 2017

Approved. Merged. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants