【问题标题】:CoreData: NSSortDescriptor - Á to A, à to A (@selector)CoreData:NSSortDescriptor - Á 到 A,à 到 A (@selector)
【发布时间】:2023-03-24 03:03:01
【问题描述】:

我正在使用 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:)]];

如何同时使用?

谢谢,

强化学习

【问题讨论】:

    标签: core-data nssortdescriptor


    【解决方案1】:

    您应该使用 UILocalizedIndexedCollat​​ion 对条目进行排序和分类。实现这一点的代码在问题NSFetchedResultsController v.s. UILocalizedIndexedCollation

    UILocalizedIndexedCollat​​ion 旨在根据当前语言设置对每种语言的单词进行分类。 Á 和 à 将放在 A 部分。

    【讨论】:

    • 因为我希望 á 在 A 部分下方。
    猜你喜欢
    • 1970-01-01
    • 2011-11-06
    • 1970-01-01
    • 2022-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 2015-11-06
    相关资源
    最近更新 更多