Wednesday, 15 September 2010

objective c - change object in NSMutableArray -



objective c - change object in NSMutableArray -

i have nsmutablearray. in construction of array:

{ distance = 0; name = name1; town = town1; } { distance = 0; name = name2; town = town2; }

and want replace "distance". illustration "distance = 15".

how can this?

ok, let's initial nsmutablearray called initial (given contains nsmutabledictionary objects...

to alter first element's distance value :

[[initial objectatindex:0] setvalue:[nsnumber numberwithint:15] forkey:@"distance"];

if want perform correction every entry in array, way :

for (nsmutabledictionary* entry in initial) { [entry setvalue:[nsnumber numberwithint:15] forkey:@"distance"]; }

objective-c object replace nsmutablearray

No comments:

Post a Comment