Ios 从deleteRowsAtIndexPaths更新UITableView
我正在尝试从deleteRowsAtIndexPaths更新我的Ios 从deleteRowsAtIndexPaths更新UITableView,ios,swift,uitableview,Ios,Swift,Uitableview,我正在尝试从deleteRowsAtIndexPaths更新我的tableView,以使用animation.fade。那么,你能告诉我如何在我有两个数组的情况下更新表视图吗 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell
tableView
,以使用animation.fade。那么,你能告诉我如何在我有两个数组的情况下更新表视图吗
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell") as! PlacesTableViewCell
cell.title.text = placeArray[indexPath.row]
cell.backgroundImage.image = photoArray[indexPath.row]
return cell
}
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
println("section and row \(indexPath.section) \(indexPath.row) ")
tableView.beginUpdates()
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
tableView.endUpdates()
}
您好,请尝试:[tableView reloadData]代码>删除所需对象后尝试以下操作
self.placeArray.removeAtIndex(indexPath.row)
self.photoArray.removeAtIndex(indexPath.row)
self.tablename.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Top)
要删除整个节,请尝试以下操作:
self.placeArray.removeAll(keepCapacity: true)
self.photoArray.removeAll(keepCapacity: true)
self.tablename.deleteSections(NSIndexSet(index: indexPath.section), withRowAnimation: UITableViewRowAnimation.Fade)
希望这会有帮助。添加placeArray.removatendex(indexath.row)
和photoArray.removatendex(indexath.row)
在委托中删除行和路径之前method@Akhilrajtr如果我有一个按钮,我如何调用这个CommittedItingStyle方法?单元格中是否有用于删除的按钮?我有一个文本字段,一旦我开始编辑文本字段,我将更新tableView@Akhilrajtris是tableview单元格中的文本字段吗?您是什么时候删除该行的?困惑的我想删除整个数组索引,而不仅仅是我删除的单元格。你是指删除数组索引的tableview中的整个部分吗?是的,请删除整个部分。我已更新了删除整个部分的答案。这并不能回答问题。若要评论或要求作者澄清,请在其帖子下方留下评论。作者询问删除记录后如何更新表格。删除记录后,可以运行此命令[tableView reloadData];以更新表。