matsune / YMCalendar

Monthly event calendar framework for iOS
MIT License
218 stars 23 forks source link

Month names #1

Open lutc opened 7 years ago

lutc commented 7 years ago

Is it possible to show name of month between month sections? Like Section header

TillMoss commented 4 months 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