解压并将内容推送到表格视图中
我有一个 tableView,其中列出了我的文档目录的内容。我里面有一些 zip 文件。如果我触摸 tableView 中的文件,相应的 zip 文件将被解压缩到临时目录中。
问题是如何导航我在 tableView 中提取的内容。如果假设提取的 zip 文件包含文件夹,我应该能够在 tableView 中查看它们。实际上流程应该像 DrillDown 一样。
我可以提取 zip 文件,但问题是,必须在 tableView 中导航它们。 请给我一些想法或一些源代码来帮助我的问题。 谢谢..
I have a tableView which lists the contents of my document directory. I have some zip files in that. If I touch a file in the tableView, the corresponding zip file is unzipped in a temporary directory.
The problem is how to navigate the contents which I extracted in a tableView. If suppose, the extracted zip file contains folders, I should able to view them in a tableView. Actually the flow should be like a DrillDown.
I can able to extract the zip files, but problem is, have to navigate them in a tableView.
Please give me some ideas or some source codes which helps my problem.
Thank you..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将尽力为您提供一些有关如何解决此问题的建议。我能想到的最好的方法是设计一个表视图,每次单击列表中的项目时,该视图都会不断更新其数据源。
让我们说清楚:假设您有第一个表视图,其中包含 zip 文件列表。单击一行,将 zip 文件解压缩到本地文件夹,然后将另一个表推送到导航控制器,该表将向您显示解压缩文件的内容。
这个新表将维护一个指向父文件夹的指针(我们称之为
parent
),在开始时设置为nil
,并将包含该文件夹内容的列表因此,该数据源将向您显示根文件夹(解压 zip 文件的文件夹)的内容,以及文件夹和文件。当您单击代表文件的行时,您将实现适当的逻辑(打开文件、上传文件、编辑、通过电子邮件发送或其他操作)
当您单击代表文件夹的行时,您应该:
父
到您当前所在的文件夹(在本例中为根文件夹)[tableView reloadData]
)您的表视图应显示一个按钮或专用行,以导航回父文件夹(
parent
中包含的文件夹)参数),以便您可以随时来回。我认为该解决方案应该可以正常工作。
I'll try to give you some suggestions on how to solve this. The best way I can imagine is designing a table view that will continuously update its data source every time you click on an item in the list.
Let's make it clear: imagine that you have the first table view with the list of the zip files. You click on a row, you decompress the zip file to a local folder, then you push to your navigation controller a different table which will present you the contents of the unzipped file.
This new table will maintain a pointer to the parent folder (let's call it
parent
), set tonil
at the beginning, and will contain a list of the contents of the folder you are currently in. So, this data source will show you the contents of the root folder (the one in which you decompressed the zip file), with folders and files.When you click on a row representing a file, you will implement the appropriate logic (open the file, upload it, edit, send by email, or what else)
When you click to a row representing a folder, you should:
parent
to the folder you are currently in (in this case the root folder)[tableView reloadData]
)Your table view should present a button, or a dedicated row, to navigate back to the parent folder (the one contained in the
parent
parameter), so that you can go back and forth every time you want.That solution should work fine, I think.