UICollectionView effective drag and drop

前端 未结 5 1934
半阙折子戏
半阙折子戏 2021-01-29 17:56

I am currently trying to implement the UITableView reordering behavior using UICollectionView.

Let\'s call a UItableView TV and a UICollectionVi

5条回答
  •  悲哀的现实
    2021-01-29 18:55

    Here is another approach:

    Key difference is that this solution does not require a "ghost" or "dummy" cell to provide the drag and drop functionality. It simply uses the cell itself. Animations are in line with UITableView. It works by adjusting the collection view layout's private datasource while moving around. Once you let go, it will tell your controller that you can commit the change to your own datasource.

    I believe it's a bit simpler to work with for most use cases. Still a work in progress, but yet another way to accomplish this. Most should find this pretty easy to incorporate into their own custom UICollectionViewLayouts.

提交回复
热议问题