在 SKScene 上运行 SKTransition 会破坏原始 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];
执行transition时会不会销毁当前场景?还是还在内存中?新场景是否引用了旧场景?
最佳答案
假设你的 scene
属性是这样的 @property(weak) SKScene *scene;
那么答案是肯定的,当你呈现另一个场景或从堆栈中弹出它。
如果你有像 @property(strong) SKScene *scene
这样的属性,那么答案是否定的,你的场景将保留在内存中直到你这样做 self.scene = nil;
但请记住,SKView
会重新显示呈现的场景,因此您应该在应用中的某处将其置零以避免保留周期(当您具有 strong 属性时)。
关于ios - 在 SKScene 上运行 SKTransition 会破坏原始 SKScene 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21879747/