在 Xcode 4 中添加文件:确保路径相对于项目/如何更改路径? [英] Adding files in Xcode 4: ensure the path is relative to the project/how to change path?

查看:62
本文介绍了在 Xcode 4 中添加文件:确保路径相对于项目/如何更改路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Xcode 4 中,我无法向我的项目添加文件/资源​​,除非相对于组路径最终类似于:../../workspace/Project/Resources/thing.png

In Xcode 4, I can't add files/resources to my project without having the Relative-to-Group path end up something like: ../../workspace/Project/Resources/thing.png

理想情况下,我会有 Resources/thing.png.

Ideally I would have Resources/thing.png.

我尝试了添加文件夹、文件、创建新组的所有可能组合.我希望将我的资源保存在我的项目目录中的一个文件夹中.如果我省略文件夹,显然我的资产将与项目相关——只是项目根目录下的thing.png".

I have tried every possible combination of adding folders, files, making new groups. I wish to keep my resources in a folder within my project directory. If I omit the folder, clearly my assets will be relative to the project — just "thing.png" under the project's root.

有什么方法可以更改单个文件的路径(我已经知道如何更改组代表的位置"),以便我可以手动设置位置(例如在 Xcode 中)3,这种路径废话也会发生).

Is there any way to change the path of a single file (I already know how to 'change the location the group represents') such that I can set the location manually (such as in Xcode 3, where this path crap would happen as well).

推荐答案

我肮脏但简单的解决方案:

My dirty, but simple solution to this:

  1. 在finder中显示项目
  2. 右键单击 *.xcodeproj 文件并选择显示包内容"
  3. 使用文本编辑器(例如 TextWrangler)打开 project.pbxproj 文件
  4. 查找和将所有文件和/或组路径的绝对../../../whatever/this/path/is/in/your/case/"部分替换为"
  5. 保存文件并在 Xcode 中打开项目(即使项目已经在 Xcode 中打开,它也可以工作)

这篇关于在 Xcode 4 中添加文件:确保路径相对于项目/如何更改路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆