0
当表被填充我可以改变细胞的颜色与 cell.backgroundColor = UIColor.redColor()在无法变更cell.backgroundColor在Editingstyle.Delete迅速
如果我把它写在editingstyle .delete它什么都不做
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
cell.textLabel?.text = toDoListarr[indexPath.row]
cell.backgroundColor = UIColor.redColor()
return cell
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath){
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
if editingStyle == UITableViewCellEditingStyle.Delete {
NSUserDefaults.standardUserDefaults().setObject(toDoListarr, forKey: "toDoList")
cell.backgroundColor = UIColor.yellowColor()
toDoList.reloadData()
}
}