I am trying set objects for particular keys to an NSMutableDictionary
in a for
loop
The code:
for(int k =0;k<currenyArry.count;k++)
{
[_currenies setObject:@"0" forKey:currenyArry[k]];
}
Here, _currenies
is an NSMutableDictionary
and currenyArry
is an NSMutableArray
.
For example, currentArry
is:
[1,3,5,10,100,500,1000];
After setting the objects in _currenies
dictionary, it looks like:
{1:"0",10:"0",100:"0",1000:"0",3:"0",5:"0",500:"0"}
But I need the order based on my currenyArry
like
{1:"0",3:"0",5:"0",10:"0",100:"0",500:"0",1000:"0"}
How can I modify my code to achieve this?