如何将网站的目录结构拷贝到ios安装包内?

发布于2022-05-18 17:44:52

直接把文件夹拖到工程下面,打包后全部都到一个目录下了。有什么办法能在目录中保持文件夹的结构呢?想到一个办法就是,将目录打包成ZIP,启动程序后解压到document下面。。不知道还有没有其他更好的办法??请赐觉~

4个回答
admin
网友回答2022-05-18
看看这本书中的介绍iOS 6 Programming Cookbook下载地址: http://l4.yunpan.cn/lk/QvEEpQtRg5zAW如下章节内容(page83):1.26 Creating BundlesProblemYou want to group your resources into hierarchical structures and be able to accessthose resources at runtime with ease.Solution1.27 Loading Data from the Main BundleProblemYou have added a resource (such as an image) to your Xcode project and now, atruntime, you would like to access that resource.1.28 Loading Data from Other BundlesProblemYou have included a few images or other resources in a separate bundle inside yourmain bundle and you would like to access those resources at runtime.
admin
网友回答2022-05-18
main bundle没有二级目录可以自己做一个bundle,文件系统中弄个site.bundle,把网站内容copy进去,然后把site.bundle拖拽到工程中区
admin
网友回答2022-05-18
多谢 V哥&船哥
admin
网友回答2022-05-18
分享一下解决方法:将你的文件夹改名为xxx.bundle,再拖到xocode中(copy方式),代码中,使用NSBundle mainBundle的pathForResource:ofType获得此bundle路径,根据路径创建NSBundle对象,再对它调用pathForResource:ofType:inDirectory获取其中各级目录的文件。

回到
顶部