我有字典的阵列,它是在一种格式,在iPhone的字典数组中排序浮点数据?
resultsArray = {
id = 1;
name = test;
distance = 11.5;
id = 2;
name = test1;
distance = 0.5;
id = 3;
name = test2;
distance = 2.5;
id = 4;
name = test4;
distance = 1.5;
}
我想使用的距离键和我的浮子式距离排序的数组。那么我怎样才能排序数组使用距离是在升序?
,所以我期待的结果是这样,
resultsArray = {
id = 2;
name = test1;
distance = 0.5;
id = 4;
name = test4;
distance = 1.5;
id = 3;
name = test2;
distance = 2.5;
id = 1;
name = test;
distance = 11.5;
}
请帮助我。
谢谢!
感谢我已经尝试过的答案,但仍然有相同的问题,所以请帮助我 – Rahul
奇怪。我做了一个测试,以确认我的答案,它的工作。发布您的代码。 – gschandler