Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone SDK: subFolders inside the main bundle

in the current project I have a number of folders, with subfolders, and these contain images: 01.png, 02.png.

Folder1/FolderA/f1.png Folder1/FolderB/F1.png

When I compile the app, I looked inside the the .app and noticed that all the images are placed in the top level, with no sub-folders.

So clearly when trying to load the image this doesn't work:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"f1" ofType:@"png" inDirectory:@"Folder1/FolderA"];

But even more strangely, when loading image "f1", the image actually loads "F1"

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"f1.png"]];

Anyone have ideas on how to get around this problem?

Is there a compile option to create the folders in the app bundle?

TIA.

like image 423
user279778 Avatar asked Mar 07 '10 23:03

user279778


1 Answers

To create the subfolders inside the .app bundle, you should check the option "Create folder references for any added folders" rather than the default "Recursively create groups for any added folders" Now in XCode, your imported folder appears blue rather than yellow. Build and go and you should see folders in your .app file.

like image 199
Mugunth Avatar answered Oct 13 '22 00:10

Mugunth