2010-11-29 7 views
2
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; 
    NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:globalManagedObjectContext]; 
    [fetchRequest setEntity:entity]; 
    NSSortDescriptor *sortByName = [[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES]; 
    [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sortByName]]; 
    fetchResults = [NSMutableArray arrayWithArray:[globalManagedObjectContext executeFetchRequest:fetchRequest error:nil]]; 
    [fetchRequest release]; 
    [sortByName release]; 
    return fetchResults; 

以下のケースでは、大文字が上にあります。データのソート

Ab 
Ba 
a. 

上記と同様。ケース

答えて

5

使用

NSSortDescriptor *sortByName = [[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES selector:@selector(caseInsensitiveCompare:)]; 
-1

NSSortDescriptor * authorDescriptor = [: "著者" 昇順@:[NSSortDescriptorのalloc] initWithKey YES]を無視するための任意の解決策を教えてください。