[英]Issue with updating entries in tableview (after editing)and showing in Tableview
[英]tableView entries with Ä Ö Ü not showing
如何設置 tableView 部分索引以顯示 Ä Ö 或 Ü (即德國變音符號)
(使用 XCode-6.4 / iOS-8.4.1 / Swift 1.2):
我打算在 iOS 中創建一個 tableView,顯示帶有德語單詞的表條目。 我實現了創建一個用英語顯示單詞的 tableView。
但是現在,我的 tableView 沒有顯示任何以 Ä,ä Ö,ö 或 Ü,ü 開頭的條目(即德語變音)。
閱讀了一些關於本地化的文章,我仍然沒有得到想要的結果。
我正在使用“UILocalizedIndexCollation”。 但出於某種原因,它只包含 27 個條目(AZ,加上 #)。 但不是想要的變音!
我該怎么做才能獲得額外的 collation.sectionIndexTitles ?
這是我的代碼:
let collation = UILocalizedIndexedCollation.currentCollation() as! UILocalizedIndexedCollation
和
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return db.getNrDBEntriesPerSection(playerRealm, sectString: collation.sectionIndexTitles[section] as! String)
}
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return (collation.sectionTitles[section] as! String)
}
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return collation.sectionIndexTitles.count
}
func sectionIndexTitlesForTableView(tableView: UITableView) -> [AnyObject]! {
return collation.sectionIndexTitles
}
func tableView(tableView: UITableView, sectionForSectionIndexTitle title: String, atIndex index: Int) -> Int {
return collation.sectionForSectionIndexTitleAtIndex(index)
}
不記得細節了,但是您需要將所有字符串傳遞給 UILocalizedIndexedCollation,它會將每個字符串(例如包括以 Ä 開頭的字符串)添加到索引中的一個字符中。
或者,更改 db.getNrDBEntriesPerSection 以進行不區分大小寫、不區分變音的比較。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.