Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using resources with the same name in Xcode

Tags:

xcode

ios

iphone

Is there a way to add multiple resources with the same name to an Xcode project and have 1 of them take priority over the others?

Example: I added 2 files, both called icon.png, to an Xcode project. They are on different folders in the file system (Folder1/icon.png and Folder2/icon.png) and on different groups in Xcode. Is there a way to tell Xcode to have Folder2/icon.png take priority over Folder1/icon.png? And if only 1 icon.png exists, then use that one.

Thanks.

EDIT (2010-12-23):

You can have multiple files with the same name in an Xcode project even if they are not in separate folder references, but they are in separate groups. Once compiled, the app bundle (which will be flat with no folders in it), will only have one copy of the file (icon.png). How do you pick which copy of the file to use?

I was told that you can do this for BlackBerry. It works something like this: The compiler will go down the list of files in the project and start adding them to the app bundle. If it sees a duplicate, it will overwrite it (or not), so the files at the bottom (or at the top) will have higher precedence and will be the final bundle.

like image 527
Roberto Avatar asked Nov 14 '22 04:11

Roberto


2 Answers

This can better easily be solved by using folders within a resource bundle in your Xcode project. Take a look here: http://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFBundles/Introduction/Introduction.html

like image 197
Matthew Purland Avatar answered Dec 28 '22 08:12

Matthew Purland


Wait a second, since you specifically mentioned icon.png, are you trying to supply different iDevices (iPad, iPhone4, iTouch3...) with different icon images?

If yes, check this out, http://d.pr/W2w0 , Apple has already provided a way for us to finish this task with convenience. All you need to do is following a specific naming convention.

like image 29
Di Wu Avatar answered Dec 28 '22 07:12

Di Wu