【发布时间】:2018-09-15 19:46:27
【问题描述】:
我使用拖放来重新排列collectionView。当我开始拖动时,我更改了 collectionView 可视化。要将它改回来,我需要一个在任何情况下都会执行的方法。现在,如果我立即开始拖动并释放触摸,则不会执行以下方法:
not this:
func collectionView(_ collectionView: UICollectionView, dragSessionDidEnd session: UIDragSession)
not this:
func collectionView(_ collectionView: UICollectionView, dropSessionDidEnd session: UIDropSession)
not this:
func collectionView(_ collectionView: UICollectionView, performDropWith coordinator: UICollectionViewDropCoordinator)
谢谢。
【问题讨论】:
-
从 Apple 文档看来,dragSessionDidEnd 将在发生放置或会话中止时被调用 developer.apple.com/documentation/uikit/…
-
哈。我刚刚意识到它不能结束,因为它只能在移动时开始——所以,如果你刚刚选择了一个项目,甚至它的预览已经生成,这并不意味着你开始了拖动。因此,问题是在获得预览之前我无法获得更新的单元格状态。
标签: swift drag-and-drop uicollectionview