Xcode 4: Multiple Targets, Multiple Resources Folders with images of the same name to use with a shared Xib?

The problem you're having is that you're trying to use the blue folders as if they were normal file system folders. The blue folders are actually just groups of files for organization in the IDE and don't represent a folder hierarchy 'under the hood'.

Take a look at how it works by right-clicking on some of the images to view them in Finder and you'll notice that files in 2 different blue group folders are actually in the same directory by default.

How to use one xib referencing the same named images for multiple targets:

  1. In Finder, create a new folder in the same directory where the AppDelegate is found, probably naming it after your target.
  2. Store all your images for that target in that folder.
  3. Right-click the project's main group/folder in the top left pane and use "Add Files to 'XcodeProjectName'…".
  4. In the appearing upper pane, find and select the folder you just created on the file system.
  5. You can leave the Destination box checked or unchecked, since the files already exist at the location you specified.
  6. Keep 'Create groups for any added folders' selected to create a blue group folders.
  7. Make sure your target is checked.

Just repeat this process for each target.

When you view the xib in Xcode it will always show one version of the image, but it will be correct when you run the app.


You could try two copies of .xib, each a member of different target. .m and .h can be members of both targets, if you wish (so only .xib is duplicated).

I just posted a similiar question which might help you with this.