Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect click-press on the touchpad on Apple TV's remote?

How can I detect a "click press", not just a tap, on the touchpad on siri remote?

EDIT: My main problem was that my view had an UIButton that received the event.

like image 878
ragnarius Avatar asked Feb 08 '23 14:02

ragnarius


2 Answers

By reading the UIPressesEvent's. Detecting Gestures and Button Presses

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)
        }
    }
}
like image 115
Jeroen Bakker Avatar answered Mar 04 '23 19:03

Jeroen Bakker


My main problem was that my view had an UIButton that received the event. After disabling that button in the storyboard, the pressesBegan / pressesEnded are invoked.

like image 43
ragnarius Avatar answered Mar 04 '23 20:03

ragnarius