Hiding UIButton in GameScene

Hello,

I've created an UIButton in the playground. Now I want to hide this button from the GameScene. How can I do it?

Replies

Did you create an IBOutlet for the button ?


if so, just call myButton.isHidden = true

Yes, I did. But what I want is to hide the button in the GameScene.swift, but the UIButton is created in the GameViewController.swift.

You could use notification :

- post notification from GameViewController

- subscribe to notification in GameScene and hide the button in the function called on notification.


Or you can use delegation.