How to scroll the Collectionview that to the selected date in the index iOS swift
Problem:
I'm having one date with me.I had binded the data list to the tableView.I want to to scroll and view the date indexed data to the user.Also if next date event available then scroll to that index.How to achieve that?
Solution:
func gotoTodayIndex(selectedDate: Date) {
if let indexPath = myEventDataSource.even
collView.scrollToItem(
} else {
if let nextindexPath = myEventDataSource.even
collView.scrollToItem(
}
}
}
The above function will be act as if selected date contains event in the tableview then scroll and position to that index of scrollview.
If that date not contains any event then next available event date will be focused centre of the screen to be scrolled.
Comments
Post a Comment