1
votes

I have An NSMutableArray of NSMutableDictionary Which Looks like this

Object 1 of Array value=1 forKey=a value=2 forKey=b value=3 forKey=e

Object 2 of Array value=4 forKey=a
value=5 forKey=b value=6 forKey=c . . .Continues

Now What I need is to Change the Value For key "a" where value is 5, change it ,12 . For Example, the Changed Object 2 Will be

Object 2 of Array value=4 forKey=a
value=12 forKey=b value=6 forKey=c

I need it to do it without Looping can any understand my Question and give me the answer.

1
Why do you need to do it without looping? Any solution I could suggest would almost certainly use either explicit or internal looping. - Chuck
Can you share your most effective suggestion? - Arsalan Haider

1 Answers

0
votes

Try this (assuming your dictionaries are type NSMutableDictionary):

NSMutableDictionary *dict = [yourArray objectAtIndex: 1];
[dict setObject: [NSNumber numberWithInt: 12] forKey: @"b"];