Upvote:2

Aprove answer
NSMutableIndexSet* indexesToRemove = [NSMutableIndexSet new];
for (NSUInteger index = 0; index < [self.matchedCards count]; ++index)  {
    if (whatever) {
        [indexesToRemove addObject:index];
    }
}


[self.matchedCards removeObjectsAtIndexes:indexesToRemove];

Upvote:1

for (Card * removeCards in [matchedCards copy])
{
    [self.matchedCards removeObject:removeCards];
}

More Answer related to the Same Query

Upvote:0

[matchedCards enumerateObjectsUsingBlock:^(Card *removedCards, NSInteger idx, BOOL *stop) {
    [self.matchedCards removeObject:card];
}];

Upvote:0

// if remove all objects
[matchedCards removeAllObjects];

// if you want to remove using index
for (int i =[matchedCards count]-1; i>=0; i++) {
   if (condition) {
       [matchedCards removeObjectAtIndex:i];
   }
}

More Answer related to the Same Query

Upvote:0

for (int i = 0; i < self.matchedCards.count; i++)
{
    if ([self.matchedCards[i] isKindOfClass:[YourClass class]])
    {
        [self.matchedCards removeObject:self.matchedCards[i]];

        i--; // invalidate the removed index
    }
}
NSLog(@"%@", self.matchedCards);

Credit Goes to: stackoverflow.com

Related question with same questions but different answers