只有那些顯示適合屏幕的單元。如果滾動到下一個(屏幕外)單元格,則只顯示白色屏幕。它允許滾動,但只顯示空格。即使是一半顯示的最後一行也只剩下一半。UITableView單元問題 - 滾動時不顯示關閉屏幕單元
extension LiveTVController: UITableViewDataSource,UITableViewDelegate {
func numberOfSections(in tableView: UITableView) -> Int {
return 10
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let reuseIdentifier = tableView.tag == 1 ? ProgrammeListCell.reuseIdentifier : StreamListCell.reuseIdentifier
let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath)
if let cell = cell as? StreamListCell {
cell.programmeList.delegate = self
cell.programmeList.dataSource = self
}
return cell
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return tableView.tag == 2 ? 10 : 0
}
現在向下滾動下一行之後。共有10個部分返回,每個部分有1行。
表視圖是否存在於滾動視圖中?單元格內是否存在滾動視圖?視圖中有手勢識別器嗎?看看你的用戶界面,似乎你有左/右滑動瀏覽屏幕,請確認。 – Windindi
@ Windindi我在桌面視圖中的主視圖和集合視圖上有tableView。 –
爲什麼你的tableView 10節?每節只有1條記錄? – wieseman