OGeek|极客世界-中国程序员成长平台

标题: ios - 未找到 SpriteBuilder 图像文件 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 08:23
标题: ios - 未找到 SpriteBuilder 图像文件

我在 sprit builder 资源文件夹中添加了一个 .png 图像并已发布。

我在 Published-IOS 下的 Resources 中的 sprite builder 所有文件夹中看到添加的图像。

这里我尝试通过以下方式访问添加的图像。

enter image description here

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

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

但是这些方法都不起作用。

它在日志中显示错误。

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

请帮我解决这个问题。我是使用此 sprit builder 的新手。



Best Answer-推荐答案


@"Down.png"更改为 @"Resources/Down.png" 因为您必须包含在 SpriteBuilder 中创建的文件夹,以便对托管资源文件的任何引用由 SpriteBuilder 提供。

同样,如果您在名为“Levels”的子文件夹中有 some.ccb,则必须使用字符串 @"Levels/some.ccb" 加载它。

关于ios - 未找到 SpriteBuilder 图像文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24410157/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4