samsoffes/sstoolkit — Issue #108: SSCollectionViewItem highlighting state is not cleared when touch ended.
Author: axfree
Created: 2012-01-03 11:47:34+00:00
State: open

Hello,

In SSCollectionViewItem.m

```
- (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 the touches ended outside of view item boundary, the view item touched will stay highlighted.
So, here's the fix:

```
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self setHighlighted:NO animated:NO];

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

Thanks.