I have a NSArray
of Contact
objects, we can call it contacts
. Contact is a superclass, FacebookGroup
and Individual
are subclasses of Contact
. FacebookGroup
has a property called individuals
which is a set of Individual
objects.
I also have a NSArray
of NSString
objects, we can call it userIDs
.
What I want to do is create a new NSArray
from the existing contacts
array that match the userIDs in userIDs
.
So if contacts
has 3 Contact
objects with userID
1,2 and 3. And my userIDs
has a NSString
object 3. Then I want the resulting array to contain Contact
which equals userID
3.
Contact.h
Contact : NSObject
FacebookGroup.h
FacebookGroup : Contact
@property (nonatomic, strong) NSSet *individuals;
Individual.h
Individual : Contact
@property (nonatomic, strong) NSString *userID;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…