我们可以从NSMutablearray删除所有其他(奇数/偶数方式)行吗?
答案 0 :(得分:2)
您可以使用NSMutableArray的-removeObjectsAtIndexes:一次删除特定索引处的所有对象:
NSMutableArray *array = ...;
NSMutableIndexSet *indexes = [[[NSMutableIndexSet alloc] init] autorelease];
// Some loop to populate 'indexes' with the indices of the odd/even items
[array removeObjectsAtIndexes:indexes];