【发布时间】:2013-01-23 02:38:05
【问题描述】:
我正在使用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];
}
}
这有什么问题?
【问题讨论】:
标签: ios objective-c xcode uitableview nsmutablearray