Can you add the springy cells effect when scrolling (like in the Messages app on iOS7) to an UITableView
? I've seen examples of it working on an UICollectionView
, but absolutely nothing for table views.
Is it just not possible and I should change every table view to a collection view and redo all the cells?
Unfortunately, no.
Every
UICollectionView
has a layout object (aUICollectionViewLayout
subclass) that describes where each cell should go in the collection view's scroll view and which cells are visible in a given CGRect.UITableView
doesn't have this, so it would be much harder to do anything that manipulates the position of its cells.In addition to animating
UIView
objects, UIKit Dynamics can be used to animateUICollectionViewLayoutAttributes
directly, which is necessary for aUITableView
orUICollectionView
style class that has reusable cells that may not all be on screen, but which would still be part of theUIDynamicAnimator
's "physics".UIDynamicAnimator
methods such aslayoutAttributesForCellAtIndexPath:
can then be used to populate your layout object.There being no equivalent layout object for a
UITableView
, and no equivalentUIDynamicAnimator
code to operate on off-screenUITableView
cells, it's likely to be much easier for you to switch to aUICollectionView
if you want this behaviour.