Touchesbegan 方法从 viewcontroller 开始无效
Touchesbegan method inactive from viewcontroller
当我从 viewcontroller 添加 UIImageview 时,我想让 touchesbegan 方法在按下 uiimage 之前处于非活动状态。
现在我已经设置好了一切,我只需要知道如何通过在 viewcontroller.
中设置代码(仅)来防止游戏场景注意到触摸
有人知道怎么做吗?
GameScene.paused = true // this pauses the game, but the touchesbegan method is still active!
您可以在要禁用触摸的视图上将 userInteractionEnabled
设置为 false,或者您可以在触摸开始时进行检查,如下所示:
if GameScene.paused == true {
return
}
当我从 viewcontroller 添加 UIImageview 时,我想让 touchesbegan 方法在按下 uiimage 之前处于非活动状态。
现在我已经设置好了一切,我只需要知道如何通过在 viewcontroller.
中设置代码(仅)来防止游戏场景注意到触摸有人知道怎么做吗?
GameScene.paused = true // this pauses the game, but the touchesbegan method is still active!
您可以在要禁用触摸的视图上将 userInteractionEnabled
设置为 false,或者您可以在触摸开始时进行检查,如下所示:
if GameScene.paused == true {
return
}