hmm. Ok. in that case try implementing this delegate funciton ->
func scrollDidEndDecelerating(for calendar: JTAppleCalendarView) {
let visibleDates = calendarView.visibleDates()
// etc etc
}
closing issue, but let me know if it helped.
This doesn't cut it if you have multiple months where you can keep scrolling but still want to see what month you are in without stopping. Maybe I will send a PR with this feature...
OK sorry. maybe i misunderstood the problem. I thought that delegate function will do it.
Let me double check this now.
I now see what you mean. I not sure i'll be able to get to that upgrade right away. But i'll take a look when i'm free.
OK hey, here is an idea, let me know if this can work for you.
in the cellForItemAt function, cells are configured.
Inside that function you have a parameter called cellState.
Is it possible you can try this?
class MyViewController: UIViewController {
...
...
var currentMonthIndex: Int ?
func calendar(_ calendar: JTAppleCalendarView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTAppleCell {
let dataSection = cellState.dateSection()
if dataSection.month != currentMonthIndex {
currentMonthIndex = dataSection.month
let visibleDates = calendarView.visibleDates()
// etc etc
}
...
...
}
I just tested it, and it works.
I think it should be able to work for you.
Let me know.
closing issue now.
Let me know. And if unsolved, i'll re-open it
I get limited control with this... I want to change my outside header right when the top most visible month header reaches the bottom of my outside header... this is a problem since I can not access the scrollViewDidScroll using the contentOffset...
@JesusAdolfo can you try master branch?
we recently added the scrollViewDidScroll function.
func calendarDidScroll(_ calendar: JTAppleCalendarView)
put this is podfile to try the master branch ->
pod 'JTAppleCalendar', :git => 'https://github.com/patchthecode/JTAppleCalendar.git', :branch => 'master'
Let me know if it worked?
Alright this is is awesome... Haven't tried yet but definitely will once you release as a new version. I extended my own delegate from the existing one to get the contentOffset 馃憤
protocol CustomCalendarDelegate: JTAppleCalendarViewDelegate
When are you releasing a new version with this included?
It would make my code cleaner, no need to extend your protocol
Well, first i have to test it, but you can use that branch till its released. My master branches as stable enough.