I'm dynamically adding a custom cell to a UITableView
and I'd like each cell to have a button which can remove that cell from the data structure and reload the views.
didSelectRowAt indexPath
is able to remove the element from my data structure by using indexPath.section
and indexPath.row
, and then reload the table, but how can I do this on touch of a button within the cell?
It was suggested to move the logic to the button's touchUpInside, but how can I do that? And how can I receive the section and row of the cell that the button was pressed in to know which element to remove from the data structure?