如何将可拖动内容返回到 iPhone 开发中的原始位置?
我想在我的 iPhone 应用程序中创建一个按钮,触摸该按钮时会将其他可拖动元素返回到其原始位置。我看过 Apple“MoveMe”示例,但这会将按钮返回到屏幕中心。我希望能够在屏幕周围定位可拖动对象,在应用程序中拖动对象,然后将它们返回到原始状态通过按指定按钮开始位置。
如有任何帮助,我们将不胜感激!
I am wanting to create a button in my iPhone app that when touched will return other draggable elements to their original position. I have looked at the Apple "MoveMe' example, but that returns the button to the center of the screen. I want to be able to position draggable objects around the screen, drag the objects within the app, and then return them to their original starting positions by pressing a designated button.
Any help appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
缓存可拖动对象的初始位置,并使用按钮上的事件处理程序来重置它们的位置。我有点困惑。 MoveMe 示例代码正是回答您的问题所需要的——您还想要什么?对于您能想到的任何问题,您都找不到完美的代码示例。
Cache the initial positions of your draggable objects, and use an event handler on the button to reset their positions. I'm a little confused. The MoveMe example code is exactly what you need to answer your question -- what more do you want? You won't find a perfect code example for any arbitrary problem you can dream up.
尝试保存原始位置并使用 MoveMe 重置对象,我敢打赌您很快就会得到您想要的东西。
Play around with saving the original positions and using MoveMe to reset the objects and I bet you'll have what your looking for in no time at all.