Reputation: 16051
I'm wondering how I should go about detecting a long press on a UIButton I have? I've heard of UILongPressGestureRecognizer but am totally unsure how to use it.
Upvotes: 2
Views: 1492
Reputation: 5388
I'm not sure about the UILongPressGestureRecognizer
, but you could start a NSTimer
when the button is hit, and then when the timer goes off check to see if it is still down.
Upvotes: 3
Reputation: 10548
Use this:
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(selectorname)];
[anyView addGestureRecognizer:longPressGesture];
[longPressGesture release];
Upvotes: 7