Ravi
Ravi

Reputation: 1759

how to filter an array containing the nsDictionary and add those filtered elements into an array ,,in iphone app

in my iphone app i am working with NSDictionary

i have a Array which contains a dictionary like this

arrSelectedVersions(
        {
        CellStateKey = 0;
        CellTextKey = Airlines;
    },
        {
        CellStateKey = 1;
        CellTextKey = Audit;
    }
)

now i need to pic the values for the key 'CellTextKey' n i should add those values into an array, how can i do this can any buddy help me,,

Upvotes: 1

Views: 179

Answers (1)

KingofBliss
KingofBliss

Reputation: 15115

Try this,

NSMutableArray *newArray=[[NSMutableArray alloc]init];
for(NSDictionary *dict in arrSelectedVersions)
{
[newArray addObject:[dict objectForKey:@"CellTextKey"]];
}

Upvotes: 1

Related Questions