在SKScene上运行SKTransition会破坏原点SKScene吗? [英] Does running a SKTransition on a SKScene destroy the origin SKScene?

查看:130
本文介绍了在SKScene上运行SKTransition会破坏原点SKScene吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SKScene上运行SKTransition会破坏原点SKScene吗?

Does running a SKTransition on a SKScene destroy the origin SKScene?

例如:

 SKTransition *reveal = [SKTransition revealWithDirection:SKTransitionDirectionDown duration:1.0];
    GameConfigScene *newScene = [[GameConfigScene alloc] initWithSize: CGSizeMake(1024,768)]];
//  Optionally, insert code to configure the new scene.
    [self.scene.view presentScene: newScene transition: reveal];

执行转换时是否会销毁当前场景?还是记忆中的?新场景是否有参考旧场景?

Will the current scene be destroyed when the transition is executed? Or is still on memory? Has the new scene a reference to the old scene?

推荐答案

让我们假设你的场景属性是这样的 @property(弱)SKScene * scene; 然后答案是YES,当你呈现另一个场景或从堆栈弹出它时会被销毁。

如果您的房产如 @property(强)SKScene *场景,那么答案是否定的,您的场景将保留在内存中,直到您完成这个 self.scene = nil;

但请记住, SKView 会视频显示所呈现的场景你应该在你的应用程序中的某个地方取消它以避免保留周期(当你拥有强大的财产时)。

Lets assume that your scene property is like this @property(weak) SKScene *scene; then the answer is YES, will be destroyed when you present another scene or pop it from the stack.
If you have your property like @property(strong) SKScene *scene, then the answer is NO, your scene will stay in memory until you do this self.scene = nil;
But remember that the SKView retinas the presented scene so you should nil it somewhere in your app to avoid retain cycles (when you have strong property).

这篇关于在SKScene上运行SKTransition会破坏原点SKScene吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆