Swift 阻止表格生成已删除的单元格
这是我用来在RSS提要阅读器中生成常规表单元格的代码:Swift 阻止表格生成已删除的单元格,swift,uitableview,cell,generated,Swift,Uitableview,Cell,Generated,这是我用来在RSS提要阅读器中生成常规表单元格的代码: override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { // Function adds the title to each cell let cell = tableView.dequeueReusableCellWithIdentifier("
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// Function adds the title to each cell
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
let item = feedItems[indexPath.row] as MWFeedItem
cell.textLabel?.text = item.title
return cell
}
我想在上面的函数中添加一个if语句,在用户已经删除提要的情况下,该语句将停止函数生成表单元格。我知道如何检查它是否已被删除,if后面的括号中会有什么内容,但实际if语句中不会有什么内容
if(/*table cell has been deleted*/)
{
/*code that stops this feed from being regenerated*/
}
实现这一点的方法是实际删除feedItems中的项目,然后使用tableView.reloadData重新加载tableView。这将为tableView提供正确数量的元素,仅绘制feedItems中包含的所有元素
希望这有帮助。你说的。。。用户是否已删除源?