按钮应该触发动作,直到我按住按钮
我有 UIscrollview,其中放置了图像。我使用按钮(触摸向下)在滚动视图内将图像的位置移动 5 个像素……只有当我重复触摸按钮时,按钮才会触发操作(它会移动图像)如果我一次又一次触摸按钮,则为 5 像素)我希望按钮触发操作,直到我按住按钮(它应该移动图像,直到我释放按钮)...
是否有可能通过按钮滚动 UIscrollview点击?
I have UIscrollview in which I have placed images.I use the buttons(touch down) to move the position of the images by 5pixels inside the scroll view…..Button fires the action only if I repeatedly touches the buttons ( it moves the images to 5pixels if I touches the button again and again) I want my button to fire the action until I keep the button down (it should moves the images until I release the button)…
Is there any possibility to scroll the UIscrollview by means of button click?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须监听 TouchDown 和 TouchUp 事件。当触发 TouchDown 事件时,您将启动一个定期调用方法的计时器(或其他计时器),当您收到 TouchUp 事件时,您将停止它。
它可能看起来像这样:(
您只需通过 IB 将您的按钮与这些方法链接起来)
You'll have to listen to the TouchDown and TouchUp events. When a TouchDown event is fired you start a timer (or other) that periodically calls a method, and when you receive a TouchUp event you stop it.
It might looks something like that:
(You just have to link your button with these methods via IB)