0
您好我是Objective-C的新手,我嘗試做一些嘗試。 我有一個名爲「值」的NSArray。它是一個數組的數組。這似乎是:如何使用嵌套的NSArray對NSArray進行排序
[ 「0」=> 「ASTRING」,6872,5523,0091]
[ 「1」=> 「anotherString」,4422,1234,0091]
[」 2「=>」aString「,6812,2143,0314] ...
如何排序」值「數組比第一個整數值? 我應該使用NSPredicate? 請幫助我一些例子。 感謝
感謝您的溶液。我發現了另一個使用這種方法靜態NSInteger intSort(id num1,id num2,void * context) { int v1 = [[num1 objectAtIndex:1] intValue]; int v2 = [[num2 objectAtIndex:1] intValue]; if(v1 v2) return NSOrderedAscending;其他 返回NSOrderedSame; } 以及此聲明:[values sortedArrayUsingFunction:intSort context:NULL]其中,值是要排序對象的NSArray。 –
Cerve86
2010-12-20 08:59:57