Skip to content

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 authored and soffes committed May 8, 2012
1 parent 6e4fe66 commit 7fb1b57
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 7fb1b57

Please sign in to comment.