Basically, I have a custom table view cell that lists potential employees. This cell includes a few labels and a button. What I want is for the button to remove the cell, but all I can find is this :
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == UITableViewCellEditingStyle.Delete {
numbers.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
}
}
Which only allows you to delete the cell if you swipe then choose "delete"
I'm thinking I should create a function in my tableViewController.swift file that will delete the cell at a given row, and in my custom cell class create an IBAction that will call said function.
What would the function to delete a cell at given row look like? But in this case, does the cell also know which row it is in or is that a job for the tableViewController?