开发者

Need a UIButton to tell me continuously whether or not it is touched

开发者 https://www.devze.com 2023-01-09 23:25 出处:网络
There\'s probably something really obvious I\'m missing, but no matter how I trawl the documentation & the blogs, I can\'t find a way to make a button report whether or not it is being touched, re

There's probably something really obvious I'm missing, but no matter how I trawl the documentation & the blogs, I can't find a way to make a button report whether or not it is being touched, regardless of whether 开发者_JAVA百科the touch moves, etc. I have an up & down button, & I need to call the relevant method whenever there is a finger on it.

Many thanks,

Franklyn Weber


Add an action to the touch down event and you are being touched up until any of the touch up events are fired. If you need to be continuously called, use an NSTimer. Start the timer on touch down and then check to see if you are still down in the timer handler. If you are, do your thing and set another timer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号