不要调用UIGestureRecognizerStateEnded [英] Do not called UIGestureRecognizerStateEnded

查看:55
本文介绍了不要调用UIGestureRecognizerStateEnded的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UIImageVIew上使用

I use on the my UIImageVIew the

-(IBAction)handlePanFrom:(UIPanGestureRecognizer *)recognizer

在我的代码中,我尝试使用两种状态:

and in the my code I try to use a two state:

if([recognizer state] == UIGestureRecognizerStateBegan)
{
      NSLog(@"Began");
}
if([recognizer state] == UIGestureRecognizerStateEnded)
{
      NSLog(@"End");
}

在控制台中,每当我开始移动UIImageView时,都会看到开始"消息,但是没有任何结束"消息...

in the console I see a "Began" message every time when I start move the UIImageView, but no any "End" message...

我做错了什么?

推荐答案

apple doc:

from apple doc:

UIGestureRecognizerStateEnded:

手势识别器已收到已识别的触摸,作为连续手势的结束.它在运行循环的下一个周期发送操作消息(或多个消息),并将其状态重置为UIGestureRecognizerStatePossible.

The gesture recognizer has received touches recognized as the end of a continuous gesture. It sends its action message (or messages) at the next cycle of the run loop and resets its state to UIGestureRecognizerStatePossible.

plz试试 UIGestureRecognizerStateCancelled

这篇关于不要调用UIGestureRecognizerStateEnded的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆