只有那些显示适合屏幕的单元。如果滚动到下一个(屏幕外)单元格,则只显示白色屏幕。它允许滚动,但只显示空格。即使是一半显示的最后一行也只剩下一半。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