steipete/PSTCollectionView — pull request #166 by taiyangc (2013-01-12 15:46:26+00:00)
Title: Fix highlighting behavior and reorganize how selection and highlighting ...

...iteract

Several things are modified / optimized to make highlighting work better in selection modes:

1. UIViews with userInteractionEnabled = True are no longer highlighted by selection. Noticed this because I had a UIButton within a cell and iOS6 UICollectionView does not highlight it when cell is selected.

2. Highlight attribute of UIViews within a cell should stay on when a cell is being clicked consecutively. Checked .highlight before and after selection with iOS6 to correct this behavior.
There were some very confusing unhighlight calls and got removed.

3. There were code paths with something like this: highlight ON -> check & change background, highlight OFF -> check & change background, selection ON -> check & change background, highlight OFF -> check & change background ... they looked inefficient and quite brain baffling because background was being controlled by two different code paths. I think the main confusion is that selection must highlight a cell while touchEvents need to highlight as well. So I reorganized and now selection path will only be keeping states of which indexPath(s) are selected and highlighting path will control how and when each UIView within cell is highlighted / unhighlighted. There will be one highlight ON for each selection instead of multiple checks.

Checked with SelectionDelegateExample and to the best of my knowledge these changes do not break anything. Well, I won't be surprised if there are corner cases I haven't seen.