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 a开发者_Go百科n easier way?
Thanks
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.
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.
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:
- uncheck "Copy items into destination group's folder"
- select "Relative to Enclosing Group"
- select the appropriate target
when adding the resource.
Is it right?
精彩评论