Indicating that a UICollectionViewCell should not be highlighted prevents it from being selected

Originator:brock
Number:rdar://16646055 Date Originated:2014-04-17
Status:Behaves correctly Resolved:
Product:iOS Product Version:7.1
Classification: Reproducible:Always
 
Summary:
A collection view cell cannot be **selected** if the collection view delegate indicates that the cell should not be **highlighted**. These should be independent factors, as the collection view delegate also has a method to indicate that a cell should not be highlighted.

Steps to Reproduce:
1. Create a collection view
2. Click on a cell; it is selected normally.
3. Implement the UICollectionViewDelegate method collectionView:shouldHighlightItemAtIndexPath: and return NO
4. Click on a cell; it is NOT selected.

Expected Results:
collectionView:shouldHighlightItemAtIndexPath: should not have any impact on whether the cell is selected. After all, that's what collectionView:shouldSelectItemAtIndexPath: is for.

Actual Results:
Returning NO from collectionView:shouldHighlightItemAtIndexPath: prevents the cell from being selected. setSelected: on the UICollectionViewCell object is not called.

Version:
iOS 7.1 (11D167)

Notes:
Potentially related to rdar://16645887

It's possible that this is the intended behavior, and the documentation needs to be updated.

Code sample: https://github.com/brockboland/CellSelectionPrevention

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!