UIWindow 从中删除子视图后停止接收触摸
我使用 UIWindow 的子类来处理应用程序所有视图中的触摸事件。 我正在尝试实现拖放机制。
当点击并按住视图时,我会删除该视图并开始用手指拖动。 问题是在我删除视图后,窗口停止接收触摸事件,直到我抬起手指并再次触摸它。
帮助?
编辑: 我发现子视图被删除后,窗口正在接收触摸,但触摸阶段是 UITouchPhaseStationary 而不是 UITouchPhaseMoved,即使 [event Touchs] 中只有一个 UITouch;这怎么可能?
I'm using a subclass of UIWindow to handle touch event in all views of the app.
I'm trying to implement a drag and drop mechanism.
When tapping and holding on a view, i remove that view and start dragging with the finger.
problem is after i remove the view the window stop receiving touch events until i lift my finger and touch it again.
help?
EDIT:
i found that after the subview is removed, the window is receiving touches but the touch phase is UITouchPhaseStationary and not UITouchPhaseMoved, even though there is only one UITouch in [event touches]; how is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定,但我认为你的问题是因为你试图处理
UIWindow
类中的事件,而不是UIViewController
类。 UIWindow 的设计初衷并不是这样做。为什么不试试这个:UIViewController
类的实例添加到您的项目中。UIViewController
的视图添加到您的UIWindow
实例中。UIViewController
。UIViewController
。(这是在
UIViewController
下交换视图,而不是在UIWindow
实例中交换视图。)I am not quite sure, but I think your problem is because your are trying to handle events in
UIWindow
class, rather thanUIViewController
class. UIWindow is not designed to do so. Why don't you try this:UIViewController
class to your project.UIViewController
to yourUIWindow
instance.UIViewController
.UIViewController
.UIViewController
, and bring in the second view, or whatever.(It is kind of swapping views under the
UIViewController
, rather than in the instance ofUIWindow
.)