Hello
The case is follow: when i set
calendarView.itemSize = calendarView.frame.width / 14
and use
calendarView.scrollToSegment(SegmentDestination.next, triggerScrollToDateDelegate: false, animateScroll: true, completionHandler: nil)
then all work correctly.
But if I set
calendarView.itemSize = calendarView.frame.width / 19
then scroll to segment only work to 5 or 6 months and no further scrolled.
Note: if use only
CalendarView.scrollingMode = .stopAtEachSection
(without programmatically scroll by scrollToSegment) then everything is working and I can scroll to the end of the year.
Calendar setup:
func configureCalendar(_ calendar: JTAppleCalendarView) -> ConfigurationParameters {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy MM dd"
// from start to the end of year
let startDate = Calendar.current.date(byAdding: .day, value: 2, to: selectedYear)!
let endDate = Calendar.current.date(byAdding: .month, value: 11, to: startDate)!
let parameters = ConfigurationParameters(startDate: startDate,
endDate: endDate,
numberOfRows: 6,
calendar: Calendar.current,
generateInDates: .forAllMonths,
generateOutDates: .tillEndOfGrid,
firstDayOfWeek: .sunday)
return parameters
}
Note 2:
I found workaround, we can use scroll to date instead
calendarView.scrollToDate(currentRightMonth!, triggerScrollToDateDelegate: false, animateScroll: true, completionHandler: nil)
Perhaps it would be useful to someone, but it only workaround.
@handioq scroll to segment currently works by scrolling to the next visible segment. This means it scrolls exactly the width of the calendarView. Do you think its better if it scrolled to the next month segment?
@patchthecode I think it would be better to make this configuration optional.
Optional? Ok.
tell me what you want accomplished, and I will try make a solution.
When you do a calendarView.scrollToSegment(.next) what do you as a programmer expect to happen?
On the call calendarView.scrollToSegment(.next) I expect to receive the next month, that is in one segment we can put a few months (in my case 2 months).
If I explained correctly ...
Ok. I will look into this.
Thank you.
Ok. After looking into it, I remembered why I coded it that way.
What exactly is "next segment" ?
Well, it seems logical that it is the next month right?
Well, in-order to know what is the next month, I would first have to know what is the current month.
Since you have decreased the size of the dateCells, more than one month may be visible on the screen at the same time. And If more than one month is visible at the same time, then how will I know which is the current month?
This was hard to determine, so I set .next to just swipe the left the the calendarView.width. Make sense?
If you have a suggestion let me know :]
Yes, that makes sense.
I understand this problem, so I will try to think about it and if I can find a solution, I will do PR. Because it is need to me more :)
Thanks man :D
Will close this in the mean time.