Getting an array of a property from an object array

前端 未结 1 1808
半阙折子戏
半阙折子戏 2020-12-04 02:57

I need to extract an array of a single property from a custom object array. eg.

@interface MyClass : NSObject 
{
    int sampleNumber;
    NSString *sampleN         


        
相关标签:
1条回答
  • 2020-12-04 03:40

    Use Key-Value Coding:

    NSArray *stringArray = [myArray valueForKey:@"sampleName"];
    
    0 讨论(0)
提交回复
热议问题