简体   繁体   中英

UIButton event “touch hold”

in Xcode 3.2 Interface Builder there was a UIButton Send Event called "touch hold". 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. 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.

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.

In interface builder, connect the button's "touch Down" send event to the IBAction turning on your light. Then connect the button's "touch Up Inside" send event to the IBAction turning off your light.

In iPad iOS 7 touch down method does not work properly.

Multitasking is enabled from setting.(4 finger multitasking).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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