オブジェクトの があり、NSArray
とContact
呼ぶことができますcontacts
。Contact はスーパークラスでFacebookGroup
ありIndividual
、のサブクラスですContact
。オブジェクトのセットであるFacebookGroup
というプロパティがあります。individuals
Individual
オブジェクトのもありNSArray
ます。NSString
これを と呼ぶことができますuserIDs
。
私がしたいのは、のユーザーIDに一致NSArray
する既存の配列から新しいを作成することです。contacts
userIDs
したがって、ifには1、2、および3 のcontacts
3 つのContact
オブジェクトがあり、myにはオブジェクト 3 があります。次に、結果の配列に3に等しいものが含まれるようにします。userID
userIDs
NSString
Contact
userID
Contact.h
Contact : NSObject
FacebookGroup.h
FacebookGroup : Contact
@property (nonatomic, strong) NSSet *individuals;
個人.h
Individual : Contact
@property (nonatomic, strong) NSString *userID;