mootymoots
mootymoots

Reputation: 4575

iPhone - Any way to set different Default.png per target?

I have two target builds in my iPhone app project, and I want to build each one with a different Default.png for the load screen. At the moment I am having to place the file with the correct name in the project folder, build, then swap it out with a different one and build the other target.

Is there an easier way?

Thanks

Upvotes: 1

Views: 789

Answers (3)

Philc
Philc

Reputation: 11

If you have 2 different Default.png files, you should be able to specify explicitly which one of them each target should copy to the application bundle.

If you expand a target in Xcode, there should be 3 subcategories where one of them defines all resources that are copied. This is the category that should contain the desired Default.png. Delete it from both your targets, and then drag each Default.png into the appropriate target to make sure they both reference the correct file.


Drag is ok but be careful to:

  1. uncheck "Copy items into destination group's folder"
  2. select "Relative to Enclosing Group"
  3. select the appropriate target

when adding the resource.

Is it right?

Upvotes: 1

jhauberg
jhauberg

Reputation: 1430

If you have 2 different Default.png files, you should be able to specify explicitly which one of them each target should copy to the application bundle.

If you expand a target in Xcode, there should be 3 subcategories where one of them defines all resources that are copied. This is the category that should contain the desired Default.png. Delete it from both your targets, and then drag each Default.png into the appropriate target to make sure they both reference the correct file.

Upvotes: 3

Rob Jones
Rob Jones

Reputation: 4985

It seems like you should be able to do this with a Custom Build Rule. See: this article. You'll definitely have to adapt what's been done. Also, I'm not sure this qualifies as easier.

If I were going this route, I'd try to insert a script into the build process that interrogates the target and copies the correct image file to Default.png.

Upvotes: 1

Related Questions