search

Home  >  Q&A  >  body text

objective-c - iOS凤凰新闻这种动画插入collectionViewCell是如何实现的?

如图:

如图,我点击了下面某个标题,它就会以动画的方式插入到上面去。

我目前已经用LXReorderableCollectionViewFlowLayout做出了拖动排序的效果,
现在想实现这个动画插入,不知各位可提供一些思路,多谢。

迷茫迷茫2773 days ago727

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:54:25

    I think it is to recalculate the position of each label, and then do a position transformation animation for each label. You can see that the rightmost one in each row moves diagonally to the first one in the next row, so it is an animation of the x and y coordinate transformation of the two positions.
    Because each label has a fixed size (at least a quarter of the superview width), the position should be easier to calculate.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:54:25

    UICollectionView不是自带动画的方法吗?

    • (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath > )indexPaths;

    • (void)deleteItemsAtIndexPaths:(NSArray<NSIndexPath > )indexPaths;

    • (void)reloadItemsAtIndexPaths:(NSArray<NSIndexPath > )indexPaths;

    • (void)moveItemAtIndexPath:(NSIndexPath )indexPath toIndexPath:(NSIndexPath )newIndexPath;

    reply
    0
  • Cancelreply