开发者

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

开发者 https://www.devze.com 2022-12-21 13:48 出处:网络
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 t

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:

  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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号