有没有办法检测用户是否点击了Apple tv遥控器的右侧或左侧?

时间:2017-10-27 08:39:18

标签: tvos apple-tv

我可以通过覆盖pressesEnded方法来检测按键,但如何在遥控器的右侧或左侧按下用户?

1 个答案:

答案 0 :(得分:-1)

检查印刷机类型时可以检测到方向性敲击:

    override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
        for press in presses {
            switch press.type {
            case .upArrow:
                print("⬆️")
            case .downArrow:
                print("⬇️")
            default:
                super.pressesBegan(presses, with: event)
            }
        }
    }

另一方面,定向点击需要使用GameControler SDK,您可以在此处找到它:https://medium.com/@dcordero/directional-clicks-on-tvos-c711a2faf71a