How to detect a touch on the touchpad on an Apple TV remote?

How can I detect a “button click”, and not just a click, on the touch panel on a remote Siri?

EDIT: My main problem was that my look at UIButton received the event.

+4
source share
2 answers

By reading the UIPressesEvent. Gesture and Button Detection

override func pressesEnded(presses: Set<UIPress>, withEvent event: UIPressesEvent?) {
    for press in presses {
        if (press.type == .Select) {
           // Select is pressed
        }  else {
            super.pressesEnded(presses, withEvent: event)
        }
    }
}
+5
source

My main problem was that in my view there was a UIButton that received this event. After disabling this button, pressesBegan / pressesEnded is called in the storyboard.

+2
source

Source: https://habr.com/ru/post/1615243/


All Articles