Animate UICollectionViewCell collapsing

拥有回忆 提交于 2019-12-14 03:47:04

问题


I'm trying to animate the height of a UICollectionViewCell when the user taps on it.

The basic functionality is working as expected. It collapses and expands when tapped BUT my UICollectionViewCells are customized and have a headerView and a contentView so when I animate the height it collapses the contentView to 0 and only the header is visible vise versa on expanding. The problem is that the contentView is just there/gone and is not animating as the cell (its superview) itself.

See the screenshots for a better understanding:

The animation when I tap on a header (red). The contentView is instantaneously visible but the cell animates behind it:

After the animation has finished everything is fine:

Tapping again collapses the cell as expected but the contentView (blue) is hidden instantaneously:

The implementation is done by performing batch updates on the collectionViewLayout. I think its just a little flag or something but I'm searching for a while now.

EDIT: After disabling auto layout in my custom UICollectionViewCell it's working perfectly BUT this seems more like a workaround to me. So I'll leave this question open.

来源:https://stackoverflow.com/questions/23113129/animate-uicollectionviewcell-collapsing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!