diff --git a/Examples/Calendar/CKViewController.m b/Examples/Calendar/CKViewController.m index 9d50374..2bad60f 100644 --- a/Examples/Calendar/CKViewController.m +++ b/Examples/Calendar/CKViewController.m @@ -100,8 +100,9 @@ - (BOOL)calendar:(CKCalendarView *)calendar willSelectDate:(NSDate *)date { return ![self dateIsDisabled:date]; } -- (void)calendar:(CKCalendarView *)calendar didSelectDate:(NSDate *)date { +- (void)calendar:(CKCalendarView *)calendar didSelectDate:(NSDate *)date withDateItem:(CKDateItem *) dateItem { self.dateLabel.text = [self.dateFormatter stringFromDate:date]; + dateItem.backgroundColor = [UIColor greenColor]; } - (BOOL)calendar:(CKCalendarView *)calendar willChangeToMonth:(NSDate *)date { @@ -118,4 +119,4 @@ - (void)calendar:(CKCalendarView *)calendar didLayoutInRect:(CGRect)frame { NSLog(@"calendar layout: %@", NSStringFromCGRect(frame)); } -@end \ No newline at end of file +@end diff --git a/Source/CKCalendarView.h b/Source/CKCalendarView.h index 4615c5a..8d4053d 100644 --- a/Source/CKCalendarView.h +++ b/Source/CKCalendarView.h @@ -72,7 +72,7 @@ typedef enum { @optional - (void)calendar:(CKCalendarView *)calendar configureDateItem:(CKDateItem *)dateItem forDate:(NSDate *)date; - (BOOL)calendar:(CKCalendarView *)calendar willSelectDate:(NSDate *)date; -- (void)calendar:(CKCalendarView *)calendar didSelectDate:(NSDate *)date; +- (void)calendar:(CKCalendarView *)calendar didSelectDate:(NSDate *)date withDateItem:(CKDateItem *)dateItem; - (BOOL)calendar:(CKCalendarView *)calendar willDeselectDate:(NSDate *)date; - (void)calendar:(CKCalendarView *)calendar didDeselectDate:(NSDate *)date; @@ -81,4 +81,4 @@ typedef enum { - (void)calendar:(CKCalendarView *)calendar didLayoutInRect:(CGRect)frame; -@end \ No newline at end of file +@end diff --git a/Source/CKCalendarView.m b/Source/CKCalendarView.m index e79e5ac..2d71911 100644 --- a/Source/CKCalendarView.m +++ b/Source/CKCalendarView.m @@ -480,7 +480,7 @@ - (void)_dateButtonPressed:(id)sender { } [self selectDate:date makeVisible:YES]; - [self.delegate calendar:self didSelectDate:date]; + [self.delegate calendar:self didSelectDate:date withDateItem:dateButton.dateItem]; [self setNeedsLayout]; } @@ -652,4 +652,4 @@ + (UIImage *)_imageNamed:(NSString *)name withColor:(UIColor *)color { return coloredImg; } -@end \ No newline at end of file +@end