I do it like this.

NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:allMyNameObjects forKeys:allMySizeObjects];

allMyNameObjects = {a,b,c,d}

allMySizeObjects = {1,2,1,3}

And is dictionary = {a:1,b:2,d:3}

"c" does not appear, because it has same size with "a".

allMySizeObjects objects has in NSNumber

Why it does not work with the same key? And how to make that work? Thank you all for your help.

有帮助吗?

解决方案

NSDictionary keys must be unique.

You can reverse keys with objects

NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:allMySizeObjects forKeys:allMyNameObjects];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top