objective c - Sorting array of wrapper objects in iOS using NSSortDescriptor -


I'm trying to sort an array of UserWrapper objects. The object is the object in the object, and the user object contains the property username (which I want to sort).

It is easy to sort an array of users, but additionally added layer UserWrapper makes things complicated for me Please help!

This is my code, which works for a simple user array:

  NSSortDescriptor * nameDescriptor = [[NSSortDescriptor alloc] initWithKey: @ "UserName" Ascending: Yes selector: @Sillector (localized CASINENCYCAVE COMPRESSOR :)]; NSArray * Diverter = [NSArray arrayWithObject: nameDescriptor]; NSMutableArray * contactsStartingWithKey = [nameIndexesDictionary objectForKey: aKey]; [Type sorting descriptor with contact starters: descriptor]; // Exception was thrown here because the userName UserWrapper has no property, but UserWrapper.User 
< The

key type of argument can have an key path in your case also:

  [[nssordiscripter alloc] initWithKey : @ "User.UserName" ascending: Yes selector: @sillector (localized CCINensitive Compaire :)];  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -