简体   繁体   English

UIButton TouchUpInside有时不会开火

[英]UIButton TouchUpInside sometimes not firing

I am creating UIButtons programmatically and set their targets as well. 我正在以编程方式创建UIButtons并设置其目标。 Most of the time TouchDown-TouchDragInside-TouchUpInside chain seems to work properly but if I perform this chain of events fast (about 2-3 times per second) method bound to TouchUpInside is sometimes not firing. 大多数时候TouchDown-TouchDragInside-TouchUpInside链似乎正常工作,但如果我快速执行此事件链(大约每秒2-3次),绑定到TouchUpInside的方法有时不会触发。

From my understanding UIEvents will always fire even if they don't fire immediately. 根据我的理解,即使他们不立即开火,UIEvents也会一直开火。 Is this a known issue that I can't seem to find anything about? 这是一个我似乎无法找到的已知问题吗? What can I do about it, besides touching things slower? 除了触摸速度之外,我能做些什么呢?

我认为你创建的按钮可以切换并点击。如果这样,两个手势也会处理不好,你可以在按钮上添加滑动手势,它运作良好;希望可以帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM