简体   繁体   中英

Background music pauses after going to a new scene Swift 3 SpriteKit

On Swift 3 and SpriteKit, the music for the apple music app pauses every time I go to a new scene. Is there any way to continue running the music after going to a new scene?

By default the scene pauses when transitioning.

Create an SKTransition instance and pausesOutGoingScene to false , and present your scene with this transition

func presentNewScene(incomingScene:SKScene)
{
    let transition = SKTransition()
    transition.pausesOutGoingScene = false
    self.view!.presentScene(incomingScene,transition:transition)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM