完全自定义 UIPIckerView?
目标: 给人赌场滚轴的感觉。
描述:我想制作一个滚动器,当我单击任何按钮时,它会自动启动......以最大速度滚动并减慢速度并在一定速度后停止,就像您在赌场滚动中看到的那样。
- 我不允许使用 UIPickerView
任何人都可以指导我,以便我可以完成这项任务
谢谢
Target: To give feel like casino scrollers.
Description: I want to make a scroller which will start automatically as i click any button... which scroll with maximum speed and slow down speed and stop after certain speed just like you must have seen in Casino scrolls.
- I am not allowed to use UIPickerView
Can any one please guide me so that i can complete this task
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道这就是解决方案。
如果您想在可点击的按钮上滚动(那么您将知道要停止的位置),因此您始终可以使用
selectRow:inComponent:animated:
选择选取器视图的指定组件中的一行。因此,您可以通过选择不需要的位置上的行来设置滚动动画,并在一段时间后(计时器完成后可以使用计时器)选择想要的位置上的行。
I know this is the heck solution.
If you want to scroll on button clickable (then you would be knowing which position to stop) so you can always use
selectRow:inComponent:animated:
Selects a row in a specified component of the picker view. so you can animate that scroll by selecting row on unwanted position and after some time(you can use timer once the timer is done) select the row at wanted position.
您可以使用内容尺寸非常大且内部有重复模式的
UIScrollView
。您可能需要额外的代码才能使其仅在适当的点停止。为了避免到达滚动视图的末尾,只要有机会,您就可以跳回重复模式的长度。You could use a
UIScrollView
with a very large content size and a repeating pattern inside it. You'd probably need extra code to make it only come to a stop at appropriate points. To avoid ever hitting the end of the scroll view, you could jump back up by the length of the repeating pattern whenever you get a chance.