Way to make a UIButton continuously fire during a press-and-hold situation?

后端 未结 4 1240
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 19:21

You know how Mario just keeps running to the right when you press and hold the right-button on the D-Pad? In the same manner, I want my UIButton to continuously fire its act

4条回答
  •  时光取名叫无心
    2020-11-29 20:11

    You can also do similar to what is shown in the previous answer and still use a UIButton.

    Just have the timer started on the "Touch Down" and have the timer stopped on either "Touch Up Inside" or "Touch Up Outside".

    Personally, I like using UIButtons because they offer some built in visual enhancements you don't have to code on your own.

提交回复
热议问题