Storing resources into "sub-bundle"?
I'd like to know if it is possible to store resources data into "sub-bundles" or "sub-packages" that I could put into my main AppBundle.
Indeed, I'd like to create a kind of player that reads "content packages", which are all organized the same way, with a standard hierarchical organization :
Package1:
- index.txt - credits.txt - Pictures/ -- Pic1.png -- Pic2.png - Movies/ -- intro.mov -- outro.movMy problem is that I can't find any way to make benefit of a hierarchical organisation into my Application package - I mean that I don't know how to distinguish "Folder1/index.txt" from "Folder2/index.txt", because I just use the "index.txt" i开发者_运维百科dentifier when I try to load the content of the file ...
I hope someone could help me, by the way I apologize for my poor english,
Cheers,
First, make sure that you're copying the files into subdirectories of Resources. One way to do this is to add your Package1 as a "folder reference" (select "Create Folder References" instead of "Recursively create groups" when you add it to the project). Another way to do it is to create a new Copy Files build action that copies the files into a subdirectory of Resources.
Once you've done that, you can use NSBundle's -pathForResource:ofType:inDirectory:
to find the particular file you want. There's no need to go to the trouble of creating a sub-bundle (which is possible, but more complex).
精彩评论