手势在一个 UIView 中开始,在另一个 UIView 中继续?
简而言之:有没有一种方法可以将正在进行的拖动手势从一个视图切换到另一个视图?
更多详细信息:我正在开发 iPad 应用程序。想象一下屏幕中间有一个运动场的情况。边界上有一堆可以拖到游戏场上的“棋子”。
当其中一个棋子被拖到运动场上时,我希望它的外观发生变化。虽然如果我有一个视图在拖到游戏场上时可以改变其外观,这可能是最简单的,但在我的特定情况下,如果有一个视图用于游戏场外外观,另一个视图用于游戏场内外观,那就更简单了。
技巧是这样的:当我将棋子拖到场上时,我希望在摆脱“场外”视图并添加“场内”视图后继续拖动。本质上,我想将手势从一个视图切换到另一个视图,同时用户进行连续的拖动。
有办法做到这一点吗?
更新:实际上使用单视图方法得到了这个工作,但我仍然好奇是否可以完成手势切换......
In brief: Is there a way to hand-off an in-progress drag gesture from one view to another?
More detail: I'm working on an iPad app. Imagine a situation where there's a playfield in the middle of the screen. On the borders are a bunch of "pieces" that can be dragged onto the playfield.
When one of the pieces is dragged onto the playfield, I want its appearance to change. Though it might be simplest if I had a single view that transformed its appearance when dragged onto the playfield, in my particular case, it's simpler if there is one view for the off-playfield appearance and another for the on-playfield appearance.
The trick is this: while I'm dragging the piece onto the field, I want the drag to continue on once I've gotten rid of my "off-playfield" view and added my "on-playfield" view. Essentially, I want to hand-off the gesture from one view to another, while the user goes through one continuous drag.
Is there a way to do this?
UPDATE: Actually got this working using the single-view approach, but am still curious as to whether a gesture hand-off can be done...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这是不可能的。可能的是拥有一个包含“之前”视图和“之后”视图的父视图。当发生拖动时,该父视图可以在两个视图之间切换,同时保持拖动。
I think this isn't possible. What is possible is to have a parent view that contains the "before" view and "after" view. As the drag occurs, that parent view can switch between the two views while maintaining the drag.