开发者

Xcode -- groups and targets

I have an Xcode project. The project currently has four targets, and I am about to add more. Within the project are about 150 png files. I have all of these in a tree of groups in the Xcode "groups and files" panel.

I want to include these png files in some of my targets, but not in others. The thing is, I will always want either all of them or none of them. I don't want to pick and choose.

Is there a way to manage this? Basically, I want some targets to use all of the files in the "png files" group, and others to use none of them. If there is a way to include an entire tree of groups in a target, and remove the same tree from another target, without having to do each file individually, that would be ideal.

EDIT: starting a bounty on this due to the lack of response. If it's not possible to do the above, I would be interested in other ways to accomplish more or less the same thing -- for example would it help to make all the png files a shared library? Or to make them a target in and of themselves, and have some of my other targets depend on that one? In either case, I would need to know how to set the thing up.

My bottom line is that I want to do the whole thing as simply as possible. For example, it should be easy to add a file to the 150 and tell my project th开发者_开发问答at it should be included in all targets that use that group of files.


I am using the Xcode 3.2.3 right now. I am able to right click on a group, select get info then jump over to the 'Targets' tab and select my targets I want those files to go into. It works for me, is this what you are looking for?


Write a script and include it in the appropriate targets as Run Script Phases. Since it gets environment variables from Xcode it’s pretty easy for the script to copy files over to the right place. You can also pass more information to the script and maintain a clean, code-only Xcode project.

You’ll have a directory full of images, and every time the script runs (as you build the targets) it copies everything. To add an image, you add it to the directory without modifying the Xcode project.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜