shoheiyokoyama / Koyomi

Simple customizable calendar component in Swift :calendar:
MIT License
749 stars 103 forks source link

Reset day background color method #54

Open doruchidean opened 6 years ago

doruchidean commented 6 years ago

Hi,

First of all, thank you for creating this library.

I am using setDayBackgrondColor(color, date) to highlight days with events, however, after editing an event, I need to update those days.

I tried using setDayBackgroundColor(color, of, to) to reset all the background to the default color, and then highlight only those ones with events. But for some reason, this method is highlighting all the days.

This is the method I'm using to reset all the backgrounds

func resetDaysBackgroundColor(month:Date) { let monthMargins = DateTimeUtils.getUnixMonthLimits(month) calendarView.setDayBackgrondColor(UIColor.white, of: Date(timeIntervalSince1970: monthMargins[0]), to: Date(timeIntervalSince1970: monthMargins[1])) } - which is making all the backgrounds YELLOW instead of WHITE

This is the method for highlighting the days with events func onDaysWithEventsReady(data: [Date]) { let color = UIColor.init(named: "app_yellow")! for date in data { calendarView.setDayBackgrondColor(color, of: date) } }