简体   繁体   English

如何向左滑动以删除 CollectionCell

[英]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。

在此处输入图像描述 Thanks all谢谢大家

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.

相关问题 滑动以删除将UITableViewCell移动到左侧 - Swipe to delete moves the UITableViewCell to the left 滑动以删除searcharray,将删除开关留在左侧 - swipe to delete searcharray leaves the delete toggle on the left 当向左滑动表格视图单元格到手机的左边缘时,它将自动触发删除UITableViewRowAction,如何禁用此功能? - when left swipe a tableview cell to the left edge of the phone, it will auto trigger the delete UITableViewRowAction , how to disable this? 向左滑动不会剪切子视图以删除UITableViewCell - Subviews not clipped on swipe left to delete UITableViewCell UITableViewCell覆盖向左滑动的删除按钮 - UITableViewCell covering delete button on swipe left iOS在UITableView上从左滑动,同时保持滑动以删除 - iOS swipe from left on UITableView while remaining Swipe to delete 在UITableViewCell中向左或向右滑动以删除没有删除按钮的单元格? - Swipe left or right anywhere in a UITableViewCell to delete the cell with no delete button? Swift-如果检测到“滑动删除”,如何在自定义tableViewCell类中隐藏按钮? - Swift - How to hide button in custom tableViewCell class if left “Swipe to delete” detected? 如何在表格视图中滑动以删除 - How to swipe to delete in a table view 如何在Xamarin.Forms中检测Stacklayout的左滑动和右滑动? - How to detect Left swipe and Right swipe for Stacklayout in Xamarin.Forms?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM