Manipulating with NSMutableArray And NSMutableDictionary Objective C
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 开发者_如何学Python2 of Array value=4 forKey=a
value=5 forKey=b value=6 forKey=c . . .ContinuesNow 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=cI need it to do it without Looping can any understand my Question and give me the answer.
Try this (assuming your dictionaries are type NSMutableDictionary):
NSMutableDictionary *dict = [yourArray objectAtIndex: 1];
[dict setObject: [NSNumber numberWithInt: 12] forKey: @"b"];
精彩评论