You can use localizedStandardCompare: as selector in the sort descriptor for the Core Data fetch request, for example
NSSortDescriptor *titleSort = [[NSSortDescriptor alloc] initWithKey:@"title"
ascending:YES
selector:@selector(localizedStandardCompare:)];
[fetchRequest setSortDescriptors:[titleSort]];
Swift 3:
let titleSort = NSSortDescriptor(key: "title",
ascending: true,
selector: #selector(NSString.localizedStandardCompare))
fetchRequest.sortDescriptors = [sortDescriptor]
or better
let titleSort = NSSortDescriptor(key: #keyPath(Entity.title),
ascending: true,
selector: #selector(NSString.localizedStandardCompare))
fetchRequest.sortDescriptors = [sortDescriptor]
where "Entity" is the name of the Core Data managed object subclass.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…