如何在单元格后的 UITableView 中放置带有 LoadMore Button 的视图

编程入门 行业动态 更新时间:2024-10-27 14:22:30
本文介绍了如何在单元格后的 UITableView 中放置带有 LoadMore Button 的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在构建一个项目.首先,我有一个 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屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 11:14:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1408892.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视图   单元格   如何在   UITableView   Button

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!