2017-07-18 4 views

Répondre

0

Pour les tableaux courts par une clé .. comme le nom .... Mettre la clé sur laquelle vous veulent court votre tableau

Cela court votre tableau Ascending

NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Your Key" ascending:YES selector:@selector(localizedStandardCompare:)]; 
NSArray *shortedArray=[Your array sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]]; 

Cela va court votre tableau Décroissant

NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"Your Key" ascending:NO selector:@selector(localizedStandardCompare:)]; 
NSArray *shortedArray=[Your array sortedArrayUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]]; 
+0

Oui, un droit ..! –

1

i utilisé DropDown pour mon projet, nous pouvons facilement personnaliser ces DropDownCell (customCell) & apparence aussi.

Vous pouvez en mesure d'intégrer votre projet par PODS

pod « DropDown »

+0

Merci pour cette aide, mais mon projet est en Objective c ...! Toute autre solution? –

+0

Vous pouvez intégrer swift dans Obj-c.check ce lien https://stackoverflow.com/questions/24102104/how-to-import-swift-code-to-objective-c –