iphone - how to sort an NSArray of nested NSArrays by array count? -


i have nsarray contains nested nsarrays. im looking way sort parent array according object count of nested arrays in ascending order. if [array1 count] 4, [array2 count] 2 , [array3 count] 9, : array2, array1, array3...

there few solutions, 1 of is:

nssortdescriptor *sd = [nssortdescriptor sortdescriptorwithkey:@"@count"                                                      ascending:yes]; nsarray *sds = [nsarray arraywithobject:sd]; nsarray *sortedarray = [array sortedarrayusingdescriptors:sds]; 

Comments

Popular posts from this blog

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -

Python __call__ special method practical example -