NsMutable数组搜索和转换

时间:2014-07-04 09:33:12

标签: objective-c nsmutablearray

我有类似的可变数组:

@protocol CategoryModel @end

@interface CategoryModel : NSObject

@property (assign) int Id;
@property (strong, nonatomic) NSString* ShortString;
@property (strong, nonatomic) NSString* Description;
@property (strong, nonatomic) NSString* AppId;

@end

我想获得AppId的Nsdata,该怎么做

我希望通过Id

搜索此NsMutableArry

1 个答案:

答案 0 :(得分:1)

据我了解,您希望通过Id从数组中获取数据。您可以使用NSPredicate

[myArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"Id == %d", yourID]];