Доброго времени суток!
У меня есть список слов, хочу добавить индексацию (А, Б, В, … Я) в таблице.
Инициализации FRC:
let sortDescriptorWordID = NSSortDescriptor(key: "word", ascending: true)
let sortDescriptorSecLetter = NSSortDescriptor(key: "sectionLetter", ascending: true)
request.sortDescriptors = [sortDescriptorSecLetter, sortDescriptorWordID]
fetchedResultsController = NSFetchedResultsController(fetchRequest: request, managedObjectContext: moc, sectionNameKeyPath: "sectionLetter", cacheName: nil)
fetchedResultsController.delegate = self as? NSFetchedResultsControllerDelegate
Показываю индексы:
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
if let currSection = fetchedResultsControllerRU.sections?[section] {
return currSection.name
}
return nil
}
func sectionIndexTitles(for tableView: UITableView) -> [String]? {
return fetchedResultsControllerRU.sectionIndexTitles
}
func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int {
return fetchedResultsControllerRU.section(forSectionIndexTitle: title, at: index)
}
В результате секции показываются, но с не правильной сортировки (Ё, А, Б, …)
В левом крае экране показывается не правильные индексы (#, !, $) вместе (А, Б, В, … Я), но как ни странно если щелкать по этим индексам проматывается данные, такое ощущение что эти индексы (А, Б, В, … Я) тама есть но они невидимы.
Если английские буквы то никаких проблема нет с индексам.
Кто сталкивался с такой проблемой, прошу поделиться.
Скриншоты: