SpriteBuilder image file not found

[亡魂溺海] 提交于 2019-12-12 17:02:54

问题


I have added a .png image in sprit builder resource folder and I have published it.

I see the added image in sprite builder all folder in Resources under Published-IOS.

Here I have tried to access the added image in following ways.

  1. _hero.spriteFrame = [CCSpriteFrame frameWithImageNamed:@"Down.png"];

  2. [_hero setTexture:[CCTexture textureWithFile:@"Game/Down.png"]]

But none of these methods are working.

it show error in log as.

 -[CCFileUtils fullPathForFilename:contentScale:] : cocos2d: Warning: File not found: Down.png

Please help me with this to resolve.Am a newbie using this sprit builder.


回答1:


Change @"Down.png" to @"Resources/Down.png" because you have to include the folders created in SpriteBuilder for any references to resource files managed by SpriteBuilder.

Likewise if you had some.ccb in a subfolder named "Levels" you'd have to load it with the string @"Levels/some.ccb".



来源:https://stackoverflow.com/questions/24410157/spritebuilder-image-file-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!