2011-03-20 45 views
2

我想知道如何去检测我在UIButton上的长按吗?我听说过UILongPressGestureRecognizer,但完全不确定如何使用它。我如何检测长按?

回答

3

我不知道有关UILongPressGestureRecognizer,但是当按钮被击中时,计时器熄灭检查,看它是否仍然下跌,你可以启动一个NSTimer,然后。

7

使用此:

UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(selectorname)]; 
[anyView addGestureRecognizer:longPressGesture]; 
[longPressGesture release]; 
+1

这并不提供对一个UIButton适当的期望行为 – 2011-06-22 13:57:19