UILongPressGestureRecognizer ,,, actionLongGesture:withEvent

来源:互联网 发布:指弹中国淘宝店 编辑:程序博客网 时间:2024/05/20 05:27

长安 手势 是没有这个 withEvent:(UIEvent*) event 参数的,而 按钮 可以带这个参数

    

       UILongPressGestureRecognizer *longGesture = [[UILongPressGestureRecognizeralloc] initWithTarget:selfaction:@selector(actionLongGesture:withEvent:)];

        

        [selfaddGestureRecognizer:longGesture];

        

        [longGesturerelease];

        




-(void) actionLongGesture:(UILongPressGestureRecognizer*)longPressGestureRecognizer withEvent:(UIEvent*) event


{


    if (longPressGestureRecognizer.state ==UIGestureRecognizerStateEnded)

     {

     

        if (delegate !=nil && [delegaterespondsToSelector:@selector(longPressAction:point:)]) {

             

         

          CGPoint point = [longPressGestureRecognizer locationInView:self];

         

             [delegatelongPressAction:selfpoint:point];

         

         }

         

     }

}




原创粉丝点击