0

Here's a video of the issue

I've been trying for weeks to find a solution yet can't find any... I can get it to work with .reloadData() but I don't want to use since it has to reload everything.

Heres the code when I click on a button the cell:

cell.hideAction = { (cell) in

            //....

            if self.Feed_ID.count == 1 {
                self.end_Feed()
            } else {

                //remove necessary data
                self.Feed_Body.remove(at: index)
                self.Feed_ID.remove(at: index)
                self.Feed_Group.remove(at: index)
                self.Feed_Date.remove(at: index)
                self.Feed_Report.remove(at: index)
                self.Feed_Votes.remove(at: index)
                self.Feed_user.remove(at: index)
                self.Feed_Owner.remove(at: index)
                self.Feed_App.remove(at: index)
                self.Feed_Contact.remove(at: index)

                let delPath = IndexPath(item: indexPath.row, section: 0)
                //tableView.deleteRows(at: [delPath], with: .left) works but displaces images
                tableView.reloadRows(at: [delPath], with: .left)

            }

        }

I also found a similar post with no answer

Thank you!!

Community
  • 1
  • 1
Adrien Zier
  • 687
  • 1
  • 7
  • 28
  • 1
    My *guess* would be that the value of `index` is captured when creating the cell, and therefore not correct when a preceding row has been deleted. – There are lots of solutions around to determine the actual table view row number from within a button action, this is the first one that I found: http://stackoverflow.com/questions/7504421/getting-row-of-uitableview-cell-on-button-press – Martin R May 20 '17 at 17:44
  • You saved my life!! haha. Thank you so much! – Adrien Zier May 20 '17 at 20:48

0 Answers0