-
Notifications
You must be signed in to change notification settings - Fork 608
Open
Labels
Description
Hello,
Is there any special actions to mark events in previous month?
for example I need to highlight any day in previous month with supplementaryView I try to do it like:
func supplementaryView(shouldDisplayOnDayView dayView: DayView) -> Bool
{
let calender = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)
var dif = calender!.compareDate(dayView.date.date, toDate: getDateDaysBefore(32), toUnitGranularity: NSCalendarUnit.DayCalendarUnit)
if (dif == NSComparisonResult.OrderedSame)
//if (dayView.date.day == 20 && dayView.date.month == 6)
{
return true
}
return false
}
func getDateDaysBefore(daysFromToday:Int) -> NSDate
{
let today = NSDate()
let tomorrow = NSCalendar.currentCalendar().dateByAddingUnit(
.CalendarUnitDay,
value: -daysFromToday,
toDate: today,
options: NSCalendarOptions(0))
return tomorrow!
}but when I scroll to previous month I got fatal error - dayView.date.date in dif is nil, dayView.date is nil, even I use commented line instead 2 lines with dif
(yes I open from private date in CVDate)
How to mark special dates in not represented month?