iphone - How to insert NSArrys into NSDictonary by without changing the order -


i facing problem insert data dictionary. not saving data in order had given it. dictionary giving 1 keys array , 1 values array this.

both arritemdetails , arritemnames nsmutablearray instances

nsarray *detailsarray = [nsarray arraywitharray:arritemdetails];  nsarray *namesarray = [nsarray arraywitharray:arritemnames];  nsdictionary *dictwithitemnamesanddetails = [nsdictionary dictionarywithobjects:arritemdetails forkeys:arritemnames]; 

but app need maintain order, please me regarding this.

i giving outputs of namesarray (keys) , detailsarray (valuesarray) , after adding them how dictionary kk

printing description of arritemdetails:

(     hi,     44,     5,     555,     3 ) 

printing description of arritemnames:

(     cardname,     accessnumber,     accesspause,     pin,     pause ) 

printing description of dictwithitemnamesanddetails:

<cfbasichash 0x6a90680 [0x274b380]>{type = immutable dict, count = 5, entries =>  0 : <cfstring 0xe3b4 [0x274b380]>{contents = "accessnumber"} = <cfstring 0x6d25970 [0x274b380]>{contents = "44"}  1 : <cfstring 0xe394 [0x274b380]>{contents = "pin"} = <cfstring 0x6d3cda0 [0x274b380]>{contents = "555"}  3 : <cfstring 0xe384 [0x274b380]>{contents = "pause"} = <cfstring 0x6d37080 [0x274b380]>{contents = "3"}  5 : <cfstring 0xe3a4 [0x274b380]>{contents = "accesspause"} = <cfstring 0x6d6c250 [0x274b380]>{contents = "5"}  6 : <cfstring 0xe3c4 [0x274b380]>{contents = "cardname"} = <cfstring 0x6d56c70 [0x274b380]>{contents = "hi"} } 

i want store data in needed order. main concern.

a dictionary not ordered/indexed data structure. key/value paired data structure. can not guarantee order of keys. , after inserting new key/value previous order might change. if want use dictionary, need use keys access values, not kind of index.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -