//创建手势
UILongPressGestureRecognizer
*longGesture = [[UILongPressGestureRecognizer
alloc]
initWithTarget:self
action:@selector(longPress:)];
//将创建好的手势添加到你的控件上
[view
addGestureRecognizer:longGesture];
//添加事件
-(void)longPress:(UIGestureRecognizer
*)gr
{
//确保长按只执行一次
if (gr.state==UIGestureRecognizerStateBegan)
{
NSLog(@"long press ");
}