UIButton Touch and Hold

前端 未结 5 1188
暗喜
暗喜 2020-11-28 07:45

I haven\'t found a very easy way to do this. The ways I\'ve seen require all these timers and stuff. Is there any easy way I can hold a UIButton and cause it to repeat the

5条回答
  •  一生所求
    2020-11-28 08:15

    An other way to use this NBTouchAndHoldButton. This is exactly what you want, and very easy to implement it:

    TouchAndHoldButton * pageDownButton = [TouchAndHoldButton buttonWithType:UIButtonTypeCustom];
    [pageDownButton addTarget:self action:@selector(pageDownAction:) forTouchAndHoldControlEventWithTimeInterval:0.2];
    

    Good luck!

提交回复
热议问题