开发者

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 . . .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.


Try this (assuming your dictionaries are type NSMutableDictionary):

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜