分组UITableView生成块行

发布于 2025-01-04 14:34:22 字数 379 浏览 2 评论 0原文

我希望表格视图的每一行都显示出来,因为它是自己的独立块,有点像 Twitter 应用程序在“发现”部分的方式(它们将前 3 个热门词作为 3 个块。

我正在尝试重新创建此内容和路线我试图将我的表作为分组表视图,但我不会将每一行视为一个部分的一行,而是将一行视为一个部分,从而生成块,每个块听起来只有 1 行

。就像黑客一样,我当然这不是这样做的方法,但是任何人都可以提供一些关于这种设置的提示吗?

另外我正在使用 NSFetchedResultsController 并且我需要指定我希望我的对象按日期排序,但该部分由唯一的 id 定义允许我每行生成一个部分,我的提取请求也没有任何运气,所以我想这是两个问题,

但如果我对第一部分错了,那么第二部分就无关紧要了

I want each row of my table view to appear, as it's own independent block, a little like how the Twitter app has on the Discover section (they have the top 3 trending word as 3 blocks.

I am trying to recreate this and the route I am trying to go down is having my table as a grouped tableview but instead of treating each row as a row of one section, I will treat a row as a section, thus generating blocks, each block will have only 1 row.

It sounds like a hack, I'm sure it's not the way to be doing it, but can anyone lend some tips about this kind of setup ?

Also I am using NSFetchedResultsController and I need to specify I want my objects ordered by date, but the section be defined by a unique id which would allow me to generate a section per row. I am not getting any luck with my fetch request either, so I guess this is 2 questions.

Although if I am wrong with the first part, the second becomes irrelevant.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尽揽少女心 2025-01-11 14:34:22

我不会这样做。看看 Twitter 应用程序,我毫不怀疑这是一个分组表视图,块部分使用第一行作为标题,第二行的内容具有更大的行高。

您可以根据 NSFetchedResultsController 返回的内容,在表视图数据源方法中根据需要调整部分和行。唯一需要注意的是,在使用索引路径引用核心数据对象时必须小心。

I would not do it this way. Looking at the Twitter app, I have no doubt that this is a grouped table view, and the block sections use the first row as the title and a second row with a bigger row height for the content.

You can adjust the sections and rows as needed in the table view datasource methods, based on what comes back from the NSFetchedResultsController. Only caveat is that you have to be careful when you use the index path to refer to the core data objects.

格子衫的從容 2025-01-11 14:34:22

Twitter“块”的设计建议采用分组表格视图,事实上,我确实设法通过普通表格视图实现了这一点,我只需要小心单元格后面的边框和背景颜色......

The design of the Twitter "blocks" suggest a grouped table view, in fact I did manage to achieve this with a plain table view I just needed to be careful with the borders and background colours behind the cells...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文