这个程序是只为研究和学习的目的。我是新开发的,所以没有什么特别的。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” 默认:打破 } 返回字符串(部分) } –