xcode在爲iphone構建時的資源組和文件夾引用

 其他廢話的就不一一翻譯了,主要給步驟

1,添加一個文件夾(名字隨便起只要不是resources就行)到你的項目裏(可以放在resources文件夾下面也可以同目錄),然後添加這個文件夾的引用(注意了時 folder  reference)

Game Resources

看文件夾的顏色是藍色的。

2.我做的方法和原文有點不一樣,但是目的和結果都時一樣的,

首先左擊targets下面的一個目標,然後點擊build phases 再點擊右下角的add build phases

彈出 的三個選項,選擇add run script ,然後 shell: /bin/tcsh

script:

touch -cm ${SRCROOT}/../../GameResources

 

這裏的GameResources 是你所建立的文件夾

 

到此爲止,該做的都做了,你再試一試移動你所建立的文件夾的資源是不是有點不一樣哈~~

 

 

注意:

    Before this, you probably used [[NSBundle mainBundle] resourcePath] or pathForResource:. These won’t work anymore, as all your resources are now inside ‘GameResources’ or whatever. [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@”GameResources”] or similar will need to be used instead. 就是這個方法不能再像以前那樣用了。

 

我寫的比較凌亂,如果想看得仔細一點就去原文看吧。

 

http://majicjungle.com/blog/123/

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章