這個程序是隻爲研究和學習的目的。我是新開發的,所以沒有什麼特別的。TitleForHeaderInSection不正確顯示
應該有一些接觸,被分成兩個不同的類別顯示TableView中:最近&朋友
然而,當我嘗試返回那些被作爲標題顯示(一切工作只是因爲我打算它)與TitleForHeaderInSection函數,最終只顯示一個。 (我使用了開關功能,因此,只有情況0正在顯示)。
override func numberOfSections(in tableView: UITableView) -> Int {
return 2 // Recent & Friends
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
switch section {
case 0: return "RECENT"
case 1: return "FRIENDS"
default: break
}
return String(section)
}
正如截圖上面看到,在應用程序只有兩種情況之一被退回,我真的在努力找出原因。
它的工作對我來說,你是如何創造你的頭? – Rajat
重寫func tableView(_ tableView:UITableView,titleForHeaderInSection節:Int) - > String? { 開關部{ 情況下0:返回 「近期」 殼體1:返回 「FRIENDS」 默認:打破 } 返回字符串(部分) } –