使用以下代码,可以更改单元格的框架并使更改动画化。
当增加帧的高度时,动画可以正常工作。当将其减小到原始大小时,单元格的动画会变得粗糙,迅速减小高度,没有动画效果,但集合视图的其余部分会动画变化。
为什么只在减小高度时会发生这种情况?
if (_new_h == 200){
_new_h = 70;
}
else{
_new_h = 200;
}
CustomCell *cell = (CustomCell*)[self.collectionView cellForItemAtIndexPath:indexPath];
[self.collectionView performBatchUpdates:^{
cell.frame = CGRectMake(cell.frame.origin.x, cell.frame.origin.y, cell.frame.size.width, _new_h);
} completion:nil];
当增加帧的高度时,动画可以正常工作。当将其减小到原始大小时,单元格的动画会变得粗糙,迅速减小高度,没有动画效果,但集合视图的其余部分会动画变化。
为什么只在减小高度时会发生这种情况?
new_h == 200
相关? - juanmajmjr