我所犯的错误:
Cocos2d: Get data from file(res/Teapot.png) failed!
Cocos2d: ERROR: SpriteFrame NULL不确定在使用来自CocosBuilder的图像路径时发生了什么。我已经将我的iOS项目与CocosBuilder项目一起上传到github上。正如您在设备上看到的那样,标签显示得很好,但是它缺少茶壶。
CocosBuilder截图

设备截屏

发布于 2013-07-03 20:34:19
它没有找到"Teapot.png“文件路径。
在加载CCSprite时尝试使用此方法:
NSString* path = [[NSBundle mainBundle] pathForResource:@"Teapot" ofType:@"png" inDirectory:@"res"];
CCSprite *mySprite = [CCSprite spriteWithFile:path];或
NSString* path = [[NSBundle mainBundle] pathForResource:@"Teapot" ofType:@"png"];发布于 2013-09-18 02:26:38
当将已发布的资源添加到xcode中时,您可以选择“为任何添加的文件夹创建文件夹引用”,也就是说,在资源添加后,子文件夹的颜色(在本例中为‘res’)将为蓝色而不是黄色。
https://stackoverflow.com/questions/17457090
复制相似问题