UICollectionViewCell should be extended with a setSelected:animated: method

Number:rdar://25337955 Date Originated:24-Mar-2016 04:10 PM
Status:Open Resolved:
Product:iOS SDK Product Version:9.3
Classification:Feature (New) Reproducible:Always

UICollectionViewController supports animated cell selection via its selectItemAtIndexPath:animated: method. The “animated” parameter is however not conveyed to the selected UICollectionViewCell. Instead just the regular setSelected: method is called, regardless if the selection was to be animated or not. If the selection is animated, the method is called inside a UIView animation block. 

While this works in some cases, there are other cases, where the implicit animations that UIView animation blocks provide do not suffice (complex custom CAAnimations). 

Steps to Reproduce:

Not needed / apparent form the API. 

Expected Results:

There should be a setSelected:animated: method on UICollectionViewCell that could be used instead of setSelected: if needed.

Actual Results:

Only setSelected: is available via public API.


All iOS versions. 


There is an existing private UICollectionViewCell method named _setSelected:animated:. This one creates the animation block and calls through to setSelected:. That might just need to loose that _ prefix. 

There a ways to determine if we’re currently inside an animation block. However some of those methods are not available on all but the most recent iOS versions and others can cause serious problems (e.g., rdar://25337014).


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!