Thursday, 7 March 2013

How to sort the retrieve data from CORE DATA in IOS



// Order   by   questionId.
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"Your_Attribute_of_entity" ascending:YES]; //here you can set ascending order or descending or not any order

NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];

[request setSortDescriptors:sortDescriptors];