CoreData:NSSortDescriptor - Á到 A,à到 A (@selector)
我正在使用 s 选择器 (localizedCaseInsensitiveCompare:),但我还需要使用变音符号选择器。
代码:
NSFetchRequest *request = [[NSFetchRequest alloc] init];
request.entity = [NSEntityDescription entityForName:@"CompanyActivity" inManagedObjectContext:context];
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:descriptionLanguageKey
ascending:YES
selector:@selector(localizedCaseInsensitiveCompare:)]];
我如何同时使用两者?
谢谢,
RL
I'm using s selector (localizedCaseInsensitiveCompare:), but i need also to use the Diacritic selector.
Code:
NSFetchRequest *request = [[NSFetchRequest alloc] init];
request.entity = [NSEntityDescription entityForName:@"CompanyActivity" inManagedObjectContext:context];
request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:descriptionLanguageKey
ascending:YES
selector:@selector(localizedCaseInsensitiveCompare:)]];
How can I use both?
Thanks,
RL
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 UILocalizedIndexedCollation 对条目进行排序和分类。实现此功能的代码位于问题 NSFetchedResultsController vs UILocalizedIndexedCollation
UILocalizedIndexedCollation 的构建是为了能够在每个语言基础根据当前语言设置对单词进行分类。 Á 和 à 将放在 A 部分。
You should use UILocalizedIndexedCollation for doing sorting and categorizing entries into sections. The code for implementing this is in the question NSFetchedResultsController v.s. UILocalizedIndexedCollation
The UILocalizedIndexedCollation was built to be able to on a per-language basis categorize words based on the current language settings. Á and à will be put in section A.