Reputation: 4929
I need to work with objects in NSMutableArray. I have NSMutableArray called "Albums" it contains objects "Album"
@interface Album : NSObject {
NSString *aid;
NSString *title;
NSString *ownerID;
}
I push few Album objects into "Albums" NSMutableArray, and i want to delete Album object where "title" field is "HelloWorld" for example or something else. How to do this?
Upvotes: 1
Views: 90
Reputation: 29562
This should do:
NSArray *matchingObjects = [array filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self.title = %@", @"HelloWorld"]];
[array removeObjectsInArray:matchingObjects];
Upvotes: 3