When deleting multiple UICollectionView cells, the other cells automatically move into the deleted position. However, I want the cells to keep the order without getting mixed up. How do I make it so that the next cell from the deleted cell takes up the deleted position? For example, cell at index path [0,3] moves to deleted cell [0,2] then [0,4] moves to [0,3], etc.
Asked
Active
Viewed 48 times
0

Lewis
- 1
-
Hi Lewis, you have a great question here. It is going to be difficult for someone to answer your question though if you don't provide the code you are working with. You are much more likely to get an answer if you can provide some code snippets to show the code you are working with. – Olyve Feb 11 '20 at 20:38
1 Answers
0
When you remove the cell from collection view then you need to remove that index from your array and then reload your collection view so your cell at index path [0,3] moves to deleted cell [0,2] then [0,4] moves to [0,3] vice versa.
for ex:- ArrayOfCell = [1,2,3,4]
i need to remove 2nd index of array which is 3 so when the cell value remove then array value also remove and the 3rd index means 4 will be my 2nd index
[1,2,4]
Hope you will solve your problem with that. Thanks.

Vipin Pareek
- 236
- 2
- 10