UICollectionView selection misbehaves

Originator:clozach
Number:rdar://13361117 Date Originated:06-Mar-2013 01:30 PM
Status:Open Resolved:
Product:iPhone SDK Product Version:6.x
Classification:Serious Bug Reproducible:YES
 
Summary: I have a collection view in which users can tap to select/deselect items. Tapping repeatedly on an item can get it into a state where no further taps register.

Steps to Reproduce:
1) Set breakpoints in the collection view's delegate methods:
    -collectionView:didSelectItemAtIndexPath:
  and
    -collectionView:didDeselectItemAtIndexPath:
2) Tap on an item 3 times, continuing after each breakpoint

Expected Results:
- 1st tap should break in the 'didSelect' callback
- 2nd tap should break in the 'didDeselect' callback
- 3rd tap should break in the 'didSelect' callback (again)

Actual Results:
- 1st tap breaks in the 'didSelect' callback
- 2nd tap breaks in the 'didDeselect' callback
- 3rd tap does not break _at all_

Regression:

Notes:
I found a workaround for this on StackOverflow: set the cell's selected state to NO in prepareForReuse.

The behavior "feels like" taps are ignored if the collection view's selection model gets out of sync with the cell's selection state. If so, I'd argue that this is incorrect, and that the collection view's selection model should trump the cell's when tapped.

http://stackoverflow.com/questions/13556476/uicollectionview-with-multi-select-wont-select-more-than-a-dozen-of-items/13556477#13556477

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!