Delete a UITableView row by click on custom UIButton

后端 未结 7 1073
梦谈多话
梦谈多话 2020-12-22 04:16

Basically I want to delete row on click event of a button which is a part of that row.
I can not use commit editing style because i want to perform unsubscribe and dele

7条回答
  •  忘掉有多难
    2020-12-22 04:28

    You can get the position of the button clicked in order to find the indexPath and from there find the cell that has that button:

    var position: CGPoint =  sender.locationInView(self.tableView)
    var indexPath: NSIndexPath = self.tableView.indexPathForRowAtPoint(position)!    
    var cell = self.tableView(tableView, cellForRowAtIndexPath: indexPath)
    

提交回复
热议问题