如何处理表格视图单元格值?
我有一个包含自定义单元格的表格视图,其中每个单元格都有一些 PDF 文档。
我需要使用数组和字典处理这些 PDF,但我不知道该怎么做。有没有关于如何执行此操作的示例,或者我应该维护 plist 中的值?
I have a tableview which contains custom cells where each cell has some PDF documents.
I need to handle those PDFs using array and dictionary but I don't know how to do that. Are there any examples on how to do this or should I maintain the values in plist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Basheer 所说,您应该为您创建的自定义单元格创建委托。然后将indexPath.row方法分配给自定义单元格。实现touchesBegan来获取自定义单元格的标签值,然后最终使用该标签值作为表数组的索引。
As Basheer said, you should create delegate for your custom cell, you have created. Then assign indexPath.row method to the custom cell. Implement touchesBegan to get the tag value of custom cell and then finally use that tag value as index of an array of your table.
根据我对您问题的理解,您想知道在表视图中单击了哪个自定义单元格?
假设您正在使用数组加载表。
在自定义单元格中创建委托,委托 api 应该为您提供自定义单元格的标签值。
创建自定义单元格时,将 indexPath.row 分配给自定义单元格标记属性。
然后在自定义单元格视图中实现touchesBegan api并使用委托来获取标签值。
现在使用标记值作为从中加载表的数组的索引。
As per my understanding from your question, you want to know which custom cell is clicked in the table view?
Assuming, you are loading the table using an array.
Create a delegate in Custom Cell and delegate api should give you the tag value of the custom cell.
While creating the custom cell, assign the indexPath.row to the custom cell tag property.
Then implement the touchesBegan api in the custom cell view and use the delegate to get the tag value.
Now use the tag value as index of the array from which you loaded the table.