UITapGestureRecognizer 等待第二次点击,按钮缓慢 [英] UITapGestureRecognizer waiting for second tap, buttons slow

查看:36
本文介绍了UITapGestureRecognizer 等待第二次点击,按钮缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITapGestureRecognizer 等待双击以将滚动视图缩小到原始级别.但是,有一种情况是我在滚动视图顶部添加了几个按钮.这些按钮的反应非常缓慢(缓慢),因为一旦我点击一个按钮,应用程序就会等待第二次点击.如果没有出现,则按下按钮.

I have a UITapGestureRecognizer waiting for a doubletap to zoom out an scrollview back to the original level. However there is a situation that I add a couple of buttons on top of the scrollview. These buttons react very slow (sluggishly) because once I tap a button, the app waiting for the second tap. If this does not come, the button is pressed.

有人知道如何让按钮快速响应吗?我可以在按钮打开时暂时禁用 GestureRecogniser 吗?

Anyone have an idea on how to get the buttons to respond quickly? Can I temporarily disable the GestureRecogniser while the buttons are up?

干杯尼克

推荐答案

像这样过滤触摸按钮怎么样:

What about filtering touches on the buttons like so:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer 
       shouldReceiveTouch:(UITouch *)touch {
// Don't recognize taps in the buttons
return ((! [self.button1 pointInside:[touch locationInView:self.button1] withEvent:nil]) &&
        (! [self.button2 pointInside:[touch locationInView:self.button2] withEvent:nil]));
}

?

这篇关于UITapGestureRecognizer 等待第二次点击,按钮缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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