SpriteKit:场景完成呈现时回调?

SpriteKit: callback when scene is done presenting?

在SpriteKit中,场景转换完成后是否有回调?

看起来 SKView presentScene 函数没有回调。

另一种方法是让场景在场景进入视图后手动通知调用者,但希望有一个更简洁的方法和本机回调。

presentScene 在场景完成转换时没有已知的回调,而是使用 Notifications 或在您的传出场景上创建您自己的某种委托 func willMove(from:view) 来实现想要的效果

func willMove(from view:SKView)
{
   NotificationCenter.default.post(name: "TRANSITIONCOMPLETE", object: nil)
   //or create a delegate using protocols, assign the delegate, and call it
   delegate?.finishedTransition()
}

请注意,您必须使用 outgoingScenes willMove(from:view),这是过渡期间发生的最后一件事。 didMove(to:view) incomingScene 是过渡的开始