1. <tfoot id='m7JCw'></tfoot>
        <bdo id='m7JCw'></bdo><ul id='m7JCw'></ul>
      1. <legend id='m7JCw'><style id='m7JCw'><dir id='m7JCw'><q id='m7JCw'></q></dir></style></legend>

        <small id='m7JCw'></small><noframes id='m7JCw'>

      2. <i id='m7JCw'><tr id='m7JCw'><dt id='m7JCw'><q id='m7JCw'><span id='m7JCw'><b id='m7JCw'><form id='m7JCw'><ins id='m7JCw'></ins><ul id='m7JCw'></ul><sub id='m7JCw'></sub></form><legend id='m7JCw'></legend><bdo id='m7JCw'><pre id='m7JCw'><center id='m7JCw'></center></pre></bdo></b><th id='m7JCw'></th></span></q></dt></tr></i><div id='m7JCw'><tfoot id='m7JCw'></tfoot><dl id='m7JCw'><fieldset id='m7JCw'></fieldset></dl></div>

        Cocos2D 场景内存管理

        Cocos2D scene memory management(Cocos2D 场景内存管理)

      3. <small id='htwB5'></small><noframes id='htwB5'>

          <tbody id='htwB5'></tbody>

      4. <i id='htwB5'><tr id='htwB5'><dt id='htwB5'><q id='htwB5'><span id='htwB5'><b id='htwB5'><form id='htwB5'><ins id='htwB5'></ins><ul id='htwB5'></ul><sub id='htwB5'></sub></form><legend id='htwB5'></legend><bdo id='htwB5'><pre id='htwB5'><center id='htwB5'></center></pre></bdo></b><th id='htwB5'></th></span></q></dt></tr></i><div id='htwB5'><tfoot id='htwB5'></tfoot><dl id='htwB5'><fieldset id='htwB5'></fieldset></dl></div>

        <legend id='htwB5'><style id='htwB5'><dir id='htwB5'><q id='htwB5'></q></dir></style></legend>

              <tfoot id='htwB5'></tfoot>
                <bdo id='htwB5'></bdo><ul id='htwB5'></ul>
                1. 本文介绍了Cocos2D 场景内存管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个关于 Cocos2D 的问题.我的游戏中有 2 个场景,场景中都有很多精灵.当我替换一个场景并加载另一个场景时发生了什么?是所有精灵都自动删除还是正在记忆中,当我在场景的dealloc中释放时会释放?

                  I have a question about Cocos2D. I have 2 scenes in my game both have a lot of sprites on the scene. What happened when I replace the one scene and load another? Are all sprites removed automatically or it is taking memories and will be release when I release in dealloc of the scene?

                  我无法理解在这种情况下内存是如何管理的,所以任何人都可以向我解释一下,还有一件事是这对我们在场景中加载精灵时保持精灵很重要.

                  I am unable to understand of this thing how the memory manage in this condition, so can any one explain me that thing and one thing more is this is important for us to make the sprite retain when we load it on the scene.

                  推荐答案

                  调用replaceScene的那一刻,两个场景都会在内存中存在一小段时间!如果您使用 CCSceneTransition,那么在过渡期间两个场景都将在内存中.

                  The moment you call replaceScene both scenes will exist in memory for a short time period! If you use a CCSceneTransition then both scenes will be in memory for the duration of the transition.

                  流程如下:

                  • 场景 A 正在运行
                  • 用sceneB调用CCDirector replaceScene
                  • 场景 B 已初始化,可能会加载精灵等
                  • 场景 A 被释放并释放内存

                  您可以在场景中实现 -(void) cleanup 方法以在更改场景之前删除其大部分内容,并且您可能希望将新内容加载到 -(void) onEnter { [超级 onEnter];} 方法.

                  You can implement the -(void) cleanup method in a scene to remove most of its content before changing the scene, and you may want to defer loading new content to the -(void) onEnter { [super onEnter]; } method.

                  就我个人而言,在这种情况下,我发现更好的方法是加载"场景,即介于两个场景之间的场景(它甚至可能在几毫秒内都不处于活动状态).这使第一个场景有时间在下一个场景初始化之前被释放.

                  Personally I find the better approach in this scenario a "loading" scene, a scene that comes in between the two scenes (it may not even be active for more than a few milliseconds). This gives the first scene time to be deallocated before the next scene is initialized.

                  这篇关于Cocos2D 场景内存管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)

                    <bdo id='TW2fv'></bdo><ul id='TW2fv'></ul>

                    <i id='TW2fv'><tr id='TW2fv'><dt id='TW2fv'><q id='TW2fv'><span id='TW2fv'><b id='TW2fv'><form id='TW2fv'><ins id='TW2fv'></ins><ul id='TW2fv'></ul><sub id='TW2fv'></sub></form><legend id='TW2fv'></legend><bdo id='TW2fv'><pre id='TW2fv'><center id='TW2fv'></center></pre></bdo></b><th id='TW2fv'></th></span></q></dt></tr></i><div id='TW2fv'><tfoot id='TW2fv'></tfoot><dl id='TW2fv'><fieldset id='TW2fv'></fieldset></dl></div>
                  • <tfoot id='TW2fv'></tfoot>
                    • <small id='TW2fv'></small><noframes id='TW2fv'>

                      <legend id='TW2fv'><style id='TW2fv'><dir id='TW2fv'><q id='TW2fv'></q></dir></style></legend>
                          <tbody id='TW2fv'></tbody>