How to call method from ViewController in GameScene

后端 未结 4 873
遇见更好的自我
遇见更好的自我 2020-12-01 13:21

I have a method that has a custom segue in my viewController that looks like this:

func gameOver() {
    performSegueWithIdentifier(\"GameOver\", sender: nil         


        
4条回答
  •  孤城傲影
    2020-12-01 14:04

    I don't have enough rep to reply to your last comment, but if you're still getting that error, that's because you haven't given that segue a name (or identifier) yet in Interface Builder!

    When you click and drag to draw segues between view controllers in Interface Builder, you can select each transition by the circle icon that appears in the center of the segue lines and give it an 'identifier'. Then, when you call performSegueWithIdentifier, it should work!

    This is what the circular icon might look like, depending on the type of segue:

    Segue icon that lets you manage segue properties

    If you're a little unsure of segues, check out this tutorial or this one!

提交回复
热议问题