From 7b1a2d5fbde62c798373d06469073393cab5261d Mon Sep 17 00:00:00 2001 From: DanMorganiOS Date: Wed, 30 Dec 2015 16:43:01 -0500 Subject: [PATCH 1/2] Added dateSelectionDisabled property --- PDTSimpleCalendar/PDTSimpleCalendarViewController.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 * From 014138391f782ee0c8e229bd2e63082a1415d091 Mon Sep 17 00:00:00 2001 From: DanMorganiOS Date: Wed, 30 Dec 2015 16:45:07 -0500 Subject: [PATCH 2/2] Check for if date selection is disabled --- PDTSimpleCalendar/PDTSimpleCalendarViewController.m | 4 ++++ 1 file changed, 4 insertions(+) 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];