Enable scrollToDate on year view
I want a scrollToDateor scrollToMonth method for the new Year View
So i can scroll to the month of my need
With workaround without having an official method, i have implemented my own way to scroll to a specific Date:
func scroll(toDate date: Date, at: UICollectionView.ScrollPosition = .centeredVertically, animated: Bool = true, considerMonth: Bool = true){
let yearToScroll = c.component(.year, from: date)
let currentYear = c.component(.year, from: Date())
let monthToScroll = considerMonth ? c.component(.month, from: date) : 0
let itemIndex = (yearToScroll - (currentYear-100)) * 12 + (yearToScroll - (currentYear-100))+monthToScroll
self.yearView.scrollToItem(at: IndexPath(item: itemIndex, section: 0), at: at, animated: animated)
}
Maybe it can help you @patchthecode
unfortunately function
self.yearView.scrollToItem(at: IndexPath(item: itemIndex, section: 0), at: at, animated: animated)
not scrolling calendarYear to specified IndePath
it is called and some strange action happens (in mili seconds of time) but calendarYear still starts from the very beginning (
scrollToItem func is definitely getting called since if I put very big row for IndexPath it crashes.
@patchthecode macOs 10.14 Mojave xcode 11.3 JtAppleCalendar github "patchthecode/JTAppleCalendar" "master" using carthage