如何在单元格后的 UITableView 中放置带有 LoadMore Button 的视图 [英] How to put a view with LoadMore Button in UITableView after the cell

查看:31
本文介绍了如何在单元格后的 UITableView 中放置带有 LoadMore Button 的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个项目.首先,我有一个 TableView,我将在 Cell 末尾的 View 中放置一个 LoadMore 按钮.像这样:

I am building a project. Firstly, I have a TableView, and I'll put a LoadMore Button in a View at the end of the Cell. Like this:

但是我的一个 TableView 没有显示带有 LoadMore 按钮的视图.我找不到问题所在.

But one of my TableView doesn't show the View with the LoadMore Button. I can't find what's wrong.

如果我将视图放在单元格之前,它就会正确显示.但是如果放在单元格之后,它就不会显示.请提出解决方案.

If I put the view before the cell,then it is showing correctly. But if placed after the cell it doesn't show. Please kindly suggest solution.

推荐答案

你告诉 tableview 有多少行?

How many rows are you telling the tableview to have?

你如何控制原型单元的显示版本?

How are you controlling which version of the prototype cell is displaying?

numberOfRowsInTableView(tableView: UITableView) -> Int {
    return dataSources.count + 1
}


 func tableView(tableView: UITableView, CellForRowAt indexPath: IndexPath) -> UITableViewCell {
    if indexpath.row > dataSources.count {
         return LoadMoreCell()
    }
    return NormalCell()
}

方法签名可能有点不同,但概念是相同的

the method signature might be a little different there but the concept is the same

这篇关于如何在单元格后的 UITableView 中放置带有 LoadMore Button 的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆