From ffff5938bdf92c771984d48a5d3f2e85ba2d0d0d Mon Sep 17 00:00:00 2001 From: Wenchao Ding Date: Sun, 27 Nov 2016 21:55:32 +0800 Subject: [PATCH] Only in-range date should be selected or deselected --- FSCalendar/FSCalendar.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FSCalendar/FSCalendar.m b/FSCalendar/FSCalendar.m index 60658dc..0c0aa90 100644 --- a/FSCalendar/FSCalendar.m +++ b/FSCalendar/FSCalendar.m @@ -523,7 +523,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) { return NO; } NSDate *date = [self.calculator dateForIndexPath:indexPath]; - return [self.proxy shouldSelectDate:date atMonthPosition:monthPosition]; + return [self isDateInRange:date] && [self.proxy shouldSelectDate:date atMonthPosition:monthPosition]; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath @@ -557,7 +557,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) { return NO; } NSDate *date = [self.calculator dateForIndexPath:indexPath]; - return [self.proxy shouldDeselectDate:date atMonthPosition:monthPosition]; + return [self isDateInRange:date] && [self.proxy shouldDeselectDate:date atMonthPosition:monthPosition]; } - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath