我正在处理UITableView
数组中作为 的数据源的每个对象,如果它们满足某个语句UITableView
,我将删除它们。if
我的问题是它只会从数组中删除所有其他对象。
代码:
UIImage *isCkDone = [UIImage imageNamed:@"UITableViewCellCheckmarkDone"];
int c = (tasks.count);
for (int i=0;i<c;++i) {
NSIndexPath *tmpPath = [NSIndexPath indexPathForItem:i inSection:0];
UITableViewCell * cell = [taskManager cellForRowAtIndexPath:tmpPath];
if (cell.imageView.image == isCkDone) {
[tasks removeObjectAtIndex:i];
[taskManager deleteRowsAtIndexPaths:@[tmpPath]
withRowAnimation:UITableViewRowAnimationLeft];
}
}
这有什么问题?