Open lutc opened 7 years ago
1- Add:
public protocol YMCalendarDateDelegate: AnyObject{ func pageChanged(date: Date) }
inside YMCalendarView.
2- After that add:
public weak var delegateDate: YMCalendarDateDelegate?
inside YMCalendarView.
3- After add:
delegateDate?.pageChanged(date: dateAt(indexPath))
Inside
private func monthRowView(at indexPath: IndexPath) -> YMMonthWeekView
before return.
4- In your ViewDidLoad add:
calendarView.delegateDate = self
5- and add:
extension YourViewController: YMCalendarDateDelegate{ func pageChanged(date: Date) { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "MMMM yyyy" self.labelMonthName.text = dateFormatter.string(from: date).capitalized } }
Enjoy
Is it possible to show name of month between month sections? Like Section header