Answer the question
In order to leave comments, you need to log in
How to remove elements from an array when removing a checkmark from a cell?
In a table of several sections, when removing checkmarkers set in cells, I delete the elements of the pressed cell from the array. removeAtIndex(indexPath.row) works erratically, then only after repeatedly removing checkmarks from a large number of clicked cells, the application crashes, then after the first removal. I can not fully understand how to correctly specify the index of the clicked cell in removeAtIndex. on the screenshot, for example, the application crashed only when the checkmark was removed from the last clicked cell (elements of one cell remained in the array)
Answer the question
In order to leave comments, you need to log in
Why, why do you insert the code with screenshots :(
There is a special tag
On the case: you use an array there as an exercise buffer. If you do everything as you need a dictionary (that is, an associative array)
I'm not sure that nsindexpath is a hashable, but the essence is
When the user marks an object
exercise[indexPath] = obj
When he removes
exercise.removeObjectForKey(indexPath)
I can make mistakes with the method
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question