Skip to content

How to mark with dot or supplementaryView past/future month events? dayView is nil #100

@olesya0

Description

@olesya0

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions