iOS Swift:UITableViewCell删除行后编辑设置为真
在UITableView中删除一行后,我创建的下一行的编辑设置为true。我不确定这是为什么,但它的意思是,在我删除一行之后,我创建的下一行是 删除单元格后,是否需要将表格或单元格设置为iOS Swift:UITableViewCell删除行后编辑设置为真,ios,swift,uikit,Ios,Swift,Uikit,在UITableView中删除一行后,我创建的下一行的编辑设置为true。我不确定这是为什么,但它的意思是,在我删除一行之后,我创建的下一行是 删除单元格后,是否需要将表格或单元格设置为editing=false func removeItems(items: [CKRecord], indexPath: NSIndexPath) { for item in items { db.deleteRecordWithID(item.recordID) { (record, e
editing=false
func removeItems(items: [CKRecord], indexPath: NSIndexPath) {
for item in items {
db.deleteRecordWithID(item.recordID) { (record, error) -> Void in
if error != nil {
println(error.localizedDescription)
}
dispatch_async(dispatch_get_main_queue()) { () -> Void in
if let index = find(exercises, item) {
exercises.removeAtIndex(index)
}
}
}
}
days.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
}
显然,删除一行并不会禁用对该行的编辑。我在
deleteRowsAtIndexPaths
之前添加了这一行,这似乎起到了作用:
tableView.cellforrowatinexpath(indexPath)?.setEditing(false,动画:false)
我的理解是,当我在单元格上滑动时,我启用了对该单元格的编辑。因为我插入的下一个单元格位于同一索引,所以在启用编辑的情况下绘制它。将
cell.editing=false
添加到cellforrowatinexpath
解决了这个问题,但它似乎很难处理。