Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我现在有一个滚动视图。每行有 2 张图像。我想为此视图添加长按排序,但我认为最好用集合视图替换此滚动视图以便于排序。我没有找到任何东西来学习如何通过长按对集合视图进行排序。我希望用户能够长按每个图像并移动它以对图像进行排序。
感谢任何帮助。谢谢。
您可以使用该方法moveItemAtIndexPath:toIndexPath:来执行此操作。这是文档链接。您只需要为每个单元格添加一个手势识别器,并在删除视图后调用该方法。
moveItemAtIndexPath:toIndexPath:
在调用上述方法之前,您可能需要编写代码来获取源单元格和目标单元格的索引路径。
另请查看此文档页面的末尾。