草庐IT

UILongGestureRecognizer

全部标签

ios - UIMenuController 在 UILongGestureRecognizer 上不可见

我针对同一问题在SO上提到了各种帖子。但仍然无法得到解决方案。我有子类UIButton,我有UILongGestureRecognizer。我的实现如下:-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){UILongPressGestureRecognizer*longGesture=[[UILongPressGestureRecognizeralloc]initWithTarget:selfaction:@selector(longPress:)];[selfaddGestureReco

ios - 如果用户轻微移动,UILongGestureRecognizer 不会触发

目前我正在使用UILongPressGestureRecognizer向UIButton添加一个函数,然后调用setMinimumPressDuration:1在按钮之后调用该函数被按下1秒钟。然而,我发现的一个问题是,如果用户在按下按钮时将手指移动半厘米,它就不会调用该函数。换句话说,即使按钮是100x100像素,用户基本上必须在一个像素上保持触摸一秒钟才能激活触发器。使用鼠标这很容易,但在物理设备上就成了问题。有没有办法来解决这个问题?我正在考虑创建一个触发器,以便如果一个按钮的alpha值UILongGestureRecognizer问题,我将如何实现这一目标。在移动设备上发布。