I am trying to have the following method call, sorted. Can I use sortdescriptors? If so how should I do it?
NSArray *subcategoriesNames = [self.dataManager getSubcategoriesOfCategory:self.category];
for (SubcategoryEntity *subcategory in subcategoriesNames) {
NSLog(@"print all subcategories %@",subcategory.icon);
NSLog(@"print all subcategories %@",subcategory.title);
BaseTableItem *item = [[BaseTableItem alloc] initWithText:subcategory.title andIcon:subcategory.icon];
[self.tableItems addObject:item];
[item release];
I need that subcategoriesNames gets sorted before its used in the loop.
Datamanager
is a Coredata
object. Its retrieving a set of rows from a database, each row has a title and an icon. I need the sort to happen by title.