简体   繁体   English

使用TouchDown事件来防止触发TouchUpInside事件

[英]Use TouchDown event to prevent TouchUpInside event from firing

I've got some UIButtons which all have TouchUpInside events. 我有一些UIButtons都有TouchUpInside事件。 A few of them also have TouchDown events. 其中一些还具有TouchDown事件。 In certain circumstances I would like the code in the TouchDown event to prevent the TouchUpInside event from firing. 在某些情况下,我希望TouchDown事件中的代码防止触发TouchUpInside事件。

How can I short-circuit that event series? 如何使该事件系列短路?

您可以在touch down方法中设置一个标志,然后在touch up inside方法中检查该标志的状态,以决定是否执行其常规操作。

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

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