我们在Xcode中切换SpriteBuilder中的scene时,一般使用的是如下代码:

-(void)exitButtonPressed:(CCControl*)sender{
    CCLOG(@"Get me outa here!");
    CCLOG(@"sender is %@",sender);

    CCScene *scene = [CCBReader loadAsScene:@"MainScene"];

    CCTransition *transition = [CCTransition transitionCrossFadeWithDuration:1.5];
    [[CCDirector sharedDirector]presentScene:scene withTransition:transition];
}

但是实际我们知道MainScene是放在SpriteBuilder中的MainScen.ccb文件中的,我们能否在代码中加后缀调用呢?答案是:不可以!

原文引用如下:

“You should not append the .ccb file extension when loading CCBs. It’s a common and understandable mistake, but CCBReader will fail to load files where you specify the .ccb extension. Published CCB files are converted to a binary format optimized for fast loading and compact storage. This binary file format carries the extension .ccbi—that’s .ccb with a trailing i. The plain text format .ccb files aren’t actually in the bundle. Therefore, it’s important to omit the file extension in calls to CCBReader. Or, perhaps to remind you of the differing extensions, you can also append the .ccbi extension.”

原来SpriteBuilder中的ccb文件为了空间和格式的需求实际被转换为ccbi文件放在bundle中,这就是原因.

但是我们可以明确加载后缀为ccbi的文件,这样是可以的:

//that's all right!!!
CCScene *scene = [CCBReader loadAsScene:@"MainScene.ccbi"];

最新文章

  1. 有哪些经常被误用的 HTML、JavaScript、CSS 的元素、方法和属性?
  2. 09——绝不在构造和析构函数中调用virtual函数
  3. 滚动监听(bootstrap)
  4. EF 关系规则(一对一、一对多、多对多...)
  5. JavaScript 札记(数据类型和变量、)
  6. java开发命名规范总结
  7. Android实例-监测网络状态及一些事件(XE8+小米2)
  8. python还不能作为主要编程语言的原因:
  9. PLSQL Developer安装(Oracle11g+win7_64bit)
  10. phantomjs API
  11. HDU 4915 Parenthese sequence _(:зゝ∠)_ 哈哈
  12. 使用MFC CImage类绘制PNG图片时遇到的问题
  13. ADO.NET初学习
  14. 【Time系列四】查询各月份的日历
  15. idea + mybatis generator + maven 插件使用
  16. JEECG 3.7.1 版本发布,企业级JAVA快速开发平台
  17. Leetcode#461. Hamming Distance(汉明距离)
  18. Day24-ModelForm操作及验证
  19. [Harbor]Docker登录Harbor仓库(HTTP方式)
  20. springboot+thymeleaf刨坑——首页加载js/css等失败解决方法

热门文章

  1. windows curl命令详解
  2. Eclipse简介和使用技巧快捷方式
  3. bmp格式图像的读写函数(对一个开源代码的封装)
  4. springMVC源码分析--HandlerInterceptor拦截器(一)
  5. hbase高性能读取数据
  6. Error running app: Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled.
  7. 06_NoSQL数据库之Redis数据库:Redis的高级应用之登录授权和主从复制
  8. HTTP请求方法
  9. 最近在线笔试的一些感想和总结,阿里巴巴,腾讯,百度,360。c++研发,机器学习等岗位
  10. 打包自己的aar库