Answer the question
In order to leave comments, you need to log in
How to properly delete a cell in a collectionView?
Tell me plz!
How, when a button is clicked, which crawls out of the cell, access the cell? The trick is that I have one more gesture hung on the view, so that when I click on any place on the phone, I can remove the editing of the cell. That is, if you click on the button outside the screen, the button will not work, but the gesture will work, which is on view.
I tried with the help of determining the coordinates of the click. But then, again, part of the button, which will not work outside the cell.
@objc func deleteImageTapped(_ sender: UITapGestureRecognizer) {
let point = sender.location(in: collectionView)
if let indexPath = collectionView.indexPathForItem(at: point) {
deleteCategory(indexPath: indexPath, context: context)
isDelete = false
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question