Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

Commit

Permalink
call deselectItemAtIndexPath in touchesEnded to toggle selection state
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy committed Feb 10, 2012
1 parent 7959e12 commit 8a0cea1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SSToolkit/SSCollectionViewItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self setHighlighted:YES animated:NO];

if (CGRectContainsPoint(self.bounds, [[touches anyObject] locationInView:self])) {
[self.collectionView selectItemAtIndexPath:self.indexPath animated:YES scrollPosition:SSCollectionViewScrollPositionNone];
if (self.isSelected) {
[self.collectionView deselectItemAtIndexPath:self.indexPath animated:YES];
} else {
[self.collectionView selectItemAtIndexPath:self.indexPath animated:YES scrollPosition:SSCollectionViewScrollPositionNone];
}
}
}

Expand Down

0 comments on commit 8a0cea1

Please sign in to comment.