diff --git a/PDTSimpleCalendar/PDTSimpleCalendarViewController.h b/PDTSimpleCalendar/PDTSimpleCalendarViewController.h index 661e056..bf5d3e1 100644 --- a/PDTSimpleCalendar/PDTSimpleCalendarViewController.h +++ b/PDTSimpleCalendar/PDTSimpleCalendarViewController.h @@ -64,6 +64,13 @@ */ @property (nonatomic, assign) BOOL weekdayHeaderEnabled; +/** + * Setting this to YES disables the ability to select a date + * + * Default value is NO. + */ +@property (nonatomic, assign) BOOL dateSelectionDisabled; + /** * Setting Text type of weekday * diff --git a/PDTSimpleCalendar/PDTSimpleCalendarViewController.m b/PDTSimpleCalendar/PDTSimpleCalendarViewController.m index 658e711..0f4c4c1 100644 --- a/PDTSimpleCalendar/PDTSimpleCalendarViewController.m +++ b/PDTSimpleCalendar/PDTSimpleCalendarViewController.m @@ -412,6 +412,10 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath { + if (self.dateSelectionDisabled) { + return NO; + } + NSDate *firstOfMonth = [self firstOfMonthForSection:indexPath.section]; NSDate *cellDate = [self dateForCellAtIndexPath:indexPath];