Excluindo objetos dentro de um loop for de um NSMutableArray
Estou trabalhando com umUITableView
e para cada um dos objetos na matriz que é a fonte de dados para oUITableView
, Estou excluindo-os se eles encontrarem uma certaif
declaração. Meu problema é que apenas exclui todos os outros objetos da matriz.
Código:
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];
}
}
O que está errado com isto?