Jtapplecalendar: get month before scrolling ends (willScrollToDateSegmentWith)

Created on 14 Apr 2018  路  14Comments  路  Source: patchthecode/JTAppleCalendar

Hi and thanks for this great calendar framework!

I麓m using version 7.15 in a new app I'm developing.

How can I get the month the user is scrolling to before scrolling is ready?

I use the following settings:

calendarView.minimumLineSpacing = 0
calendarView.minimumInteritemSpacing = 0
calendarView.scrollingMode = .stopAtEachSection
calendarView.cellSize = calendarView.frame.size.width / 7 - 4.0 // make calendar height smaller
weekDaysView?.backgroundColor = .white
calendarViewHeightConstraint.constant = 6 * calendarView.cellSize
calendarView.scrollDirection = .vertical

One delegate that is called while user is scrolling is didScrollToDateSegmentWith. Can I get the month the user scrolls to or the scroll direction (up or down) inside this function?

Already Fixed on Master Branch enhancement

Most helpful comment

i have added this as an update to master branch code -> 2c00513aab426f71787c443d017f2baf0ae5b3fc

Please test master branch code and let me know if i broke anything.

All 14 comments

How can I get the month the user is scrolling to before scrolling is ready?

It cant be done right now

func scrollDidEndDecelerating(for calendar: JTAppleCalendarView)

I meant to do this in this function. This function tells you when the calendar stops scrolling as soon as you lift your finger.
But it was supposed to be this

func scrollDidEndDecelerating(for calendar: JTAppleCalendarView, monthDetails: Details)

Marking this for enhancement.

One delegate that is called while user is scrolling is didScrollToDateSegmentWith. Can I get the month the user scrolls to or the scroll direction (up or down) inside this function?

The function is

func calendar(_ calendar: JTAppleCalendarView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo)

The visibleDates portion will tell you which dates are on the screen. And by the dates, you can tell which month is on the screen. Does your calendar have paged scrolling?

Thanks, I meant scrollDidEndDecelerating, not didScrollToDateSegmentWith
didScrollToDateSegmentWith is too late, scrolling is done at this point. The reason why I wish this is of course I display the month and year in the UINavigationController麓s large title

ok then. If it is scrollDidEndDecelerating then i have already marked this for an enhancement.
How soon do you need this? I am sorta swamped with one rather difficult project right now.

Many thanks! It would be great to have it in the next two months.

alright. that _should_ be enough time.

Thanks again!

I need this enhancement too! Preferably before this month is out...
Or hope willScrollToDateSegmentWith will be added.

Hi, I want ask again for this feature.

Thanks

Hi, any updates?
Could we expect that feature to be released _soon_?

+1 I really need this please

i have added this as an update to master branch code -> 2c00513aab426f71787c443d017f2baf0ae5b3fc

Please test master branch code and let me know if i broke anything.

It works like a charm!
Thank you so much, my calendar looks perfect now 馃憤.

calendararchitecture

@juliensagot ok cool.
I still need to do full testing on master branch to make sure that i didnt break anything though. So i will leave this open for now.

Was this page helpful?
0 / 5 - 0 ratings