带有未知单元格的动态部分 UITableView

发布于 2024-09-25 18:57:04 字数 461 浏览 1 评论 0原文

嘿, 我基本上试图从 SQlite 数据库检索数据并从中填充 tableView。

sql-data-retrieval 方法创建两个数组。 “数据数组”和“SectionArray”。

DataArray 填充有数据 NSObject。

到目前为止,我可以创建适当的节标题。

问题是,

-1 我该怎么做才能确保正确的对象进入其适当的部分而不是在任何其他部分下(他们似乎正在这样做)。每个部分中的计数(行数)也不同。

NumberOfRowsAtIndexPath”和cellForRowAtIndexPath方法中的代码应该是什么

-2 哪种数据源对象更适合这种类型。我只是填充两个 NSMutableArrays - dataArray(rows) 和SectionArray(Section headers)。

Hey,
I'm basically trying to retrieve data from SQlite db and populate a tableView from it.

The sql-data-retrieval method creates two arrays. "dataArray" and "SectionArray".

DataArray is filled with data NSObjects.

Uptil this point, i can create the appropriate Section headers.

Here is the problem,

-1 What do i do to make sure that the right objects get into their appropriate sections and not under any other sections (which they seem to be doing). Also the Count(number of rows) in each section differs.

What should the code be in "NumberOfRowsAtIndexPath" and cellForRowAtIndexPath methods

-2 What kind of datasource objects are more suited for this type. I'm simply filling up two NSMutableArrays - dataArray(rows) and SectionArray(Section headers).

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

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

发布评论

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

评论(1

蓝海 2024-10-02 18:57:04

我认为您应该为您创建的每个表头创建许多 NSArray 。在 NumberOfRowsAtIndexPath 中,您将返回所请求部分的数组计数,在 cellForRowAtIndexPath 中,您将使用部分索引(如前所述)和行索引来选择数组您将选择该数组的行。

I think you should make many NSArray one for each table header you have created. In NumberOfRowsAtIndexPath you will return the count of the array for the requested section, and in cellForRowAtIndexPath you will choose your array using the section index (as before) and with the row index you will select the row of that array.

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