简体   繁体   中英

How to swipe left to delete a CollectionCell

I am using a UICollectionView library called VegaScroll. The library is located at 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.

在此处输入图像描述 Thanks all

It is a tableView existed functionality. For collectionView you should write it on your own. 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

Or custom written simple logic like here:

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:

How do you support swiping to delete a row in a UICollectionView list with compositional layout?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM