0

So in my project, I'm trying to drag a cell from one UICollectionView and drop the cell in another UICollectionView. Now I can successfully drop the cell. However, after I drop the cell in UICollectionView2, I don't know how to remove it from UICollectionView1. I figure I could use an observer pattern to do this. But I'm wondering if there is a built-in function in the API that does it? I looked up online and I don't see a tutorial that shows this. So can anyone help me with this? Thanks!

Zezhi Xia
  • 1
  • 1
  • You can post a notification when you drop the cell in your CV2 and simply add an observer in your CV1 with a selector that removes the element there. – Leo Dabus Feb 10 '19 at 02:10
  • Possible duplicate of https://stackoverflow.com/a/30541063/2303865 – Leo Dabus Feb 10 '19 at 02:12
  • and this might help if you need to send any object back to CV1 https://stackoverflow.com/a/30329316/2303865 – Leo Dabus Feb 10 '19 at 02:14
  • I think I'll try to clarify my question. I want to know if there is a built-in function in the "Drag & Drop" api that will remove my dragged item once they are dropped. So the question is mainly about the "Drag & Drop" api. I've built an observer pattern and it works. But I'm just wondering if I can use some function in the "Drag & Drop" api to solve it. – Zezhi Xia Feb 10 '19 at 02:27
  • https://developer.apple.com/documentation/uikit/views_and_controls/collection_views/supporting_drag_and_drop_in_collection_views – Leo Dabus Feb 10 '19 at 02:35

0 Answers0