Reputation: 15
I'm learning iOS but have an issue extracting data from a multidimensional NSMutableArray
, I've looked at various solutions but have not yet found one..
I have an NSMutableArray
like
{
"service_0" = {
"name" = "name1";
"description" = "description1";
};
"service_2" = {
"name" = "name2";
"description" = "description2";
};
Etc...
}
I wish to extract data into a new NSMutableArray
(or NSArray
) to get the following output for use in text labels such as = [myArray objectAtIndex:indexPath.row]
(
name1,
name2,
Etc...
)
What would be the best solution? Thanks
Upvotes: 0
Views: 246
Reputation: 19789
Assuming that is an array of dictionaries, unlike in the question...
NSArray *newArray = [oldArray valueForKeypath:@"name"];
You can make it mutable using mutableCopy
, if you wish.
Upvotes: 1