Reputation: 372
I have an NSArray
I want to make changes to a dictionary stored in the array
My data.plist
looks like:
data Array
Item 0 Dictionary
imagename String
name String
text String
url String
Item 1 Dictionary
imagename String
name String
text String
url String
Item 2 Dictionary
imagename String
name String
text String
url String
So I want to update key imagename
and name
in all items.
How can I do that?
Upvotes: 0
Views: 1293
Reputation: 674
This should about do it.
-(void)updateKey:(id)newKey oldKey:(id)oldKey atIndex:(int)index {
[[_myArray objectAtIndex:index] removeObjectForKey:oldKey];
[[_myArray objectAtIndex:index] setObject:forObject forKey:newKey];
}
Upvotes: 1