From 9da177d033ecd5daed06d1d1f5e96dd784d1d4d3 Mon Sep 17 00:00:00 2001 From: Wenchao Ding Date: Wed, 9 Nov 2016 21:43:25 +0800 Subject: [PATCH] Fix a deselection problem --- FSCalendar/FSCalendar.m | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/FSCalendar/FSCalendar.m b/FSCalendar/FSCalendar.m index 610b687..15749bc 100644 --- a/FSCalendar/FSCalendar.m +++ b/FSCalendar/FSCalendar.m @@ -567,18 +567,10 @@ typedef NS_ENUM(NSUInteger, FSCalendarOrientation) { - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath { - if (!self.allowsMultipleSelection && self.selectedDate) { - NSIndexPath *selectedIndexPath = [self.calculator indexPathForDate:self.selectedDate]; - if (![indexPath isEqual:selectedIndexPath]) { - [self collectionView:collectionView didDeselectItemAtIndexPath:selectedIndexPath]; - return; - } - } FSCalendarCell *cell = (FSCalendarCell *)[collectionView cellForItemAtIndexPath:indexPath]; - if (cell) { - cell.selected = NO; - [cell configureAppearance]; - } + cell.selected = NO; + [cell configureAppearance]; + NSDate *selectedDate = cell.date ?: [self.calculator dateForIndexPath:indexPath]; [_selectedDates removeObject:selectedDate]; [self deselectCounterpartDate:selectedDate];