ios - Storing Multiple Values to a Single Key in NSDictionary -
in application getting data server.i parsed data , added individual arrays. here having 2 arrays.
for example
array : @"1",@"2",@"3",@"2",@"3",@"4",etc.. array b : @"a",@"b",@"c",@"d",@"e",@"f",etc..
now want create dictionary array keys , array b values. trying create dictionary this:
datadict = [nsdictionary dictionarywithobjects:b forkeys:a];
but giving single value single key. here how can store multiple values single key.
for different keys working. problem storing multiple values single key.
you can't store multiple values single key directly -- dictionaries can have 1 value per key. can store array value. so, create mutable dictionary , add keys , values 1 @ time. make values mutable arrays, , check existing value given key before setting it. if find one, add new value array.
Comments
Post a Comment