Spritekit 및 swift 3을 사용하여 게임을 만들었습니다. 내 pauseGame()
메서드를 호출하려고 할 때 내 GameScene 클래스 (SKScene의 하위 클래스)에 있습니다.), applicationWillResignActive(_ application: UIApplication)
방법 내의 AppDelegate 파일에서.AppDelegate (Swift 3, SpriteKit, Xcode 8)에서 GameScene 메서드 호출
func applicationWillResignActive(_ application: UIApplication) {
if let gameScene = GameScene(fileNamed: "GameScene") {
gameScene.pauseGame()
}
}
어떻게이 문제를 해결 할 수있는 컴파일러 오류가 작동하지 않습니다이 있지만 나는 이미 GameScene 클래스를 인스턴스화하고이 방법으로 내 AppDelegate에 파일의 메소드를 호출하려고
? 미리 감사드립니다.
applicationwillresignactive 알림을 전송, 당신은 게임 씬 클래스에서 그것을들을 수 있습니다. 애플 대행 인 – Knight0fDragon
@ Knight0fDragon에서 작업을 할 필요가 없습니다. 대답이 아니라 덧글이 아닌 – BadgerBadger
@BadgerBadger로 게시해야합니다. 그러면 저도 실제로 답을 써야합니다. 게으르다 do – Knight0fDragon