Remote onClickBegan() onClickEnded()

How can I get notified, or check myself, when the Apple remote remote touch pad is clicked (not touched)? Right now I am getting notified of clicks with the notification on the UITapGestureRecognizer, but I need to know when the click begans and ends. This way I will be able to do an action the entire time the button is being "clicked".


Here's my code now:

    UITapGestureRecognizer *selectPressedGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectPressed:)];
  
    selectPressedGesture.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypeSelect]];
  
    self.selectPressedTapGestureRecognizer = selectPressedGesture;

     [self.view addGestureRecognizer:selectPressedGesture];

-(void)selectPressed:(UITapGestureRecognizer *)gesture {
    NSLog(@"select");
}


I've also tried using the:

[GCController controllers]

to access the regular Apple remote, however it always returns an empty array.


Thanks!

Accepted Reply

Take a look at -pressesBegan: which is detailed in the Detecting Gestures and Button Presses programming guide.

Replies

Take a look at -pressesBegan: which is detailed in the Detecting Gestures and Button Presses programming guide.

Thank you so much!

For anyone else having this problem, I subclassed UITapGestureRecognizer and implemented the methods the amazing Apple Staff linked to above!

How about Ojbective C code examples?