[英]How to swipe left to delete a CollectionCell
I am using a UICollectionView library called VegaScroll.我正在使用一个名为 VegaScroll 的 UICollectionView 库。 The library is located at https://github.com/ApplikeySolutions/VegaScroll .
该库位于https://github.com/ApplikeySolutions/VegaScroll 。 My question is how can I add a swipe left feature to this, so when the user swipes left, the collection cell shows the trash image and gets deleted?
我的问题是如何向此添加向左滑动功能,因此当用户向左滑动时,收集单元格会显示垃圾图像并被删除? I know its very simple in a table, but I am using this library which is a collection view.
我知道它在表格中非常简单,但我正在使用这个库,它是一个集合视图。 I have searched on all the questions on this forum, but they haven't solved this problem.
我已经搜索了这个论坛上的所有问题,但他们没有解决这个问题。 Something like below.
像下面的东西。 I'm also using an XIB for my cell.
我还在为我的手机使用 XIB。
It is a tableView existed functionality.它是一个 tableView 存在的功能。 For collectionView you should write it on your own.
对于collectionView,您应该自己编写它。 There is no existed pre-built solution.
不存在预先构建的解决方案。
You can use the pod like this (which can what do you need)您可以像这样使用吊舱(您需要什么)
https://github.com/SwipeCellKit/SwipeCellKit https://github.com/SwipeCellKit/SwipeCellKit
Or custom written simple logic like here:或自定义编写的简单逻辑,如下所示:
https://medium.com/@ales.musto/using-a-uipangesturerecognizer-to-delete-cells-in-a-uicollectionview-swift-3-e91cdfcce5be https://medium.com/@ales.musto/using-a-uipangesturerecognizer-to-delete-cells-in-a-uicollectionview-swift-3-e91cdfcce5be
Update: There is actually a way to do this (now) with a built-in API:更新:实际上(现在)有一种方法可以使用内置 API 执行此操作:
How do you support swiping to delete a row in a UICollectionView list with compositional layout? 您如何支持通过滑动删除具有组合布局的 UICollectionView 列表中的一行?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.