在不替换行的情况下插入行中的行 -
在我的应用中,我有一个从firebase提取的数据。我有一个UitaiteViewController,并且想连续插入应用程序中的文本。 就是这样(请原谅不良的例子,但我不能
数据拉力
太多
细节
介绍
。 :JKL
第5行:Mno
我想实现的目标:
第1:ABC
第2行:DEF
ROW 3:APP
ROW 4:GHI
ROW 5:JKL
ROW 6:来自应用程序的文本
第7行:MNO
如何实现这一目标?我试图在cellforrowat
中做这样的事情,
if indexPath.row % 3 == 0 {
cell.text = "custom text"
}
但这正在替换每个第三行内容。可以这么说,我想介于两者之间。
In my app I have a data pull from Firebase. I have a UITableViewController and would like to insert in a row a text from within the app. The data pull would be like this (please excuse the bad example but I cannot go into too much detail ..)
The original data pull:
Row 1: abc
Row 2: def
Row 3: ghi
Row 4: jkl
Row 5: mno
What I would like to achieve:
Row 1: abc
Row 2: def
Row 3: text from the app
Row 4: ghi
Row 5: jkl
Row 6: text from the app
Row 7: mno
How can I achieve this? I was trying to do something like this in cellForRowAt
if indexPath.row % 3 == 0 {
cell.text = "custom text"
}
But this is replacing every 3rd rows content. I would like to put a row in between, so to speak.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用本地数据修改服务器数据。
注意:修改后,您必须重新加载
tableView
You can modify your server data with local data.
Note: After modification you have to reload the
tableView
您可以通过在第三位置插入值并在CellForrowat中使用该数据源来更新数据源
You can update the datasource by inserting the value at 3rd position and use that datasource in cellforrowat