首页 文章

添加 Headers 单元格后不会出现

提问于
浏览
0

我有大图像,然后我有桌面视图 . 这两个元素在滚动视图和表视图上:

scrollEnabled = false

我的tableView中有两个单元格,它们的高度按单元格文件中的函数计算(因为单元格中的文本是动态的)

func configure(#comment: Comment) {

    userCommentTextView.text = comment.comment
    userCommentTextView.accessibilityLabel = "Quote Content"
    userCommentTextView.accessibilityValue = comment.comment

}

一切都很好,我正在计算滚动视图的大小

scrollView.contentSize.height = tableView.frame.origin.y + tableView.frame.height

在`func tableView(tableView:UITableView,cellForRowAtIndexPath indexPath:NSIndexPath) - > UITableViewCell {}委托

但是在我添加自定义 Headers 后,所有单元格都不可见,只有我的 Headers !为什么?问题是什么?我检查过,有细胞信息 . 和

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

    return comments.count
}

不是零 . 但是cellforrowindexpath甚至没有执行 . 你能帮助我吗?

1 回答

  • 0

    尝试添加 Headers 视图

    func tableView(viewForHeaderInSection section: Int) -> UIView {}
    

    并打电话

    func tableView(heightForHeaderInSection section: Int) -> CGFloat {}
    

    func numberOfSectionsInTableView() -> Int{}
    

相关问题