Swipe To Delete TableView Row

后端 未结 8 985
暖寄归人
暖寄归人 2020-12-24 06:10

I have my array:

self.colorNames = [[NSArray alloc] 
initWithObjects:@\"Red\", @\"Green\",
@\"Blue\", @\"Indigo\", @\"Violet\", nil];

I\'ve

8条回答
  •  天命终不由人
    2020-12-24 07:00

    Swift Version:

    func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
         if editingStyle == UITableViewCellEditingStyle.Delete {
             dataArray?.removeAtIndex(indexPath.row)
             tableview.reloadData()
         }
    }
    

提交回复
热议问题