我在
中重新加载日历时崩溃了- (void)calendar:(FSCalendar *)calendar didSelectDate:(NSDate *)date
方法。它显示错误:
- (void)calendar:(FSCalendar *)calendar didSelectDate:(NSDate *)date
MYCODE:
- (void)calendar:(FSCalendar *)calendar didSelectDate:(NSDate *)date{
int i = 0;
EventDate *obj = [[EventDate alloc] init];
for (EventDate *event in selectedDates) {
if (([gregorian component:NSCalendarUnitDay fromDate:date] == [gregorian component:NSCalendarUnitDay fromDate:event.eventDate]) &&
([gregorian component:NSCalendarUnitMonth fromDate:date] == [gregorian component:NSCalendarUnitMonth fromDate:event.eventDate])&&
([gregorian component:NSCalendarUnitYear fromDate:date] == [gregorian component:NSCalendarUnitYear fromDate:event.eventDate]) ) {
[obj initEventDateWith:date andWithRole:[self getRole:event] andWithBgColor:[self getColor:event]];
[selectedDates removeObjectAtIndex:i];
[selectedDates addObject:obj];
break;
}i++;
}
}
应用程序崩溃此方法:
- (void)reloadDataForCell:(FSCalendarCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
cell.calendar = self; // here my app crash
}