UILocalizedIndexedCollation locale different than English

两盒软妹~` 提交于 2019-12-14 04:00:03

问题


I am using Tableview with UILocalizedIndexedCollation to show the index on right side but the language on my phone is Swedish (svenska) hence I see some special characters specific to Swedish language like å ä ö after A-Z . In A-Z some of the characters are missing like Q, X etc which I believe are not there in Sweidsh locale.

I am facing issue when I click say character "S" , it shows me section "R" instead of "S" even though there are entries in "S" . Also for last characters "å", "ä" it takes me to X and Y respectively , although there is no "X" in the LocalizedIndexedCollation.

I followed this tutorial too http://benedictcohen.co.uk/blog/archives/230 but it did not fixed my issue.

Any help on this would be great.

Thanks.


回答1:


Same in Korean with iOS7 GM.

I checked Japanese either, but there isn't the problem we facing.
The difference between Japanese and Korean is the ordering(link)

In Korean, Korean occurs before English.
But in Japanese, English occurs before Japanese when I tested.

When I check this method,

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
    NSLog(@"%i", index);
    NSLog(@"%i", [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index]);
}

I can notice sectionForSectionIndexTitleAtIndex increasing in accordance with given index abnormally.

  • sectionForSectionIndexTitleAtIndex increase 4 ("A" + 1 - "F"), when "ㄴ" -> "ㄷ" (index increase just 1).
  • Increment of sectionForSectionIndexTitleAtIndex is repeating. 1, 4, 1, 4 ...

My conclusion about this problem is that iOS7 bug in Unicode with ASCII ordering.
So, I will temporarily modify tableView:sectionForSectionIndexTitle:atIndex method works as I intended.



来源:https://stackoverflow.com/questions/16832164/uilocalizedindexedcollation-locale-different-than-english

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!