我一直沒能得到這個手勢來回應。tvos swift spritekit - UITapGestureRecognizer沒有響應
self.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(self.movePlayer(_:)))
tap.allowedPressTypes = [NSNumber(value: UIPressType.playPause.rawValue)]
view?.addGestureRecognizer(tap)
和功能:按下遙控器模擬器上的播放按鈕時
func movePlayer(_ sender: UITapGestureRecognizer){
player.run(SKAction.moveBy(x: 200, y: 0, duration: 10))
print("Right!")
}
什麼都沒有發生。我錯過了什麼?
你攻的時候打的選擇嗎? (我認爲這是選項,它會在模擬器遙控器上說出來) – Knight0fDragon