简体   繁体   English

UIButton 事件“触摸保持”

[英]UIButton event “touch hold”

in Xcode 3.2 Interface Builder there was a UIButton Send Event called "touch hold".在 Xcode 3.2 Interface Builder 中有一个名为“触摸保持”的 UIButton 发送事件。 This very simply executed the event as long as the button was being held.只要按住按钮,这非常简单地执行事件。 For example lets say you had a red light and UIButton that lit up the light.例如,假设您有一个红灯和 UIButton 点亮了灯。 The "touch hold" send event would keep the light lit the while the button was being pushed but when the user took his finger off the button, the light would turn off. “触摸保持”发送事件将在按下按钮时保持灯亮,但当用户将手指从按钮上移开时,灯会关闭。 Does anyone know what happened to this event and how to implement it in xcode 4.0 preferably in Interface Builder like xcode 3.2.有谁知道这个事件发生了什么以及如何在 xcode 4.0 中实现它,最好是在像 xcode 3.2 这样的接口生成器中。

Making your own seems to be the easiest route.自己做似乎是最简单的方法。 Create two IBActions, one that turns your red light off, and one that turns your red light on.创建两个 IBAction,一个关闭红灯,一个打开红灯。

In interface builder, connect the button's "touch Down" send event to the IBAction turning on your light.在界面生成器中,将按钮的“touch Down”发送事件连接到打开灯的 IBAction。 Then connect the button's "touch Up Inside" send event to the IBAction turning off your light.然后将按钮的“touch Up Inside”发送事件连接到关闭您的灯的 IBAction。

In iPad iOS 7 touch down method does not work properly.在 iPad iOS 7 触地法不能正常工作。

Multitasking is enabled from setting.(4 finger multitasking).从设置中启用多任务处理。(4 指多任务处理)。

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

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