Fix a deselection problem

This commit is contained in:
Wenchao Ding 2016-11-09 21:43:25 +08:00
parent aadc834923
commit 9da177d033
1 changed files with 3 additions and 11 deletions

View File

@ -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];