从代码启动 UIGestureRecognizer

发布于 2024-12-01 16:43:12 字数 247 浏览 3 评论 0原文

我有一个带有 UIPanGestureRecognizer 的 UIViewSubclass 球。 如果我将球拖动到其他 UIView 上方(在 UIGestureRecognizerStateChanged 中),则整个超级视图将被清除,包括球。之后球将被重新创建。

我的问题是,随着球自然地移开,UIGestureRecognizer 就会结束识别。

由于我的手指仍在屏幕上,我如何告诉新球的手势识别器开始在代码中识别?

多谢!

i got a UIViewSubclass Ball with a UIPanGestureRecognizer.
If i drag the Ball above a other UIView (in UIGestureRecognizerStateChanged) the complete Superview gets cleared including the Ball. After that the Ball will be recreated.

My problem is that, with removing the ball naturally the UIGestureRecognizer ends recognizing.

How i can tell the gestureRecognizer of the new Ball to start recognize in code, cause my finger is still on the screen?

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰火雁神 2024-12-08 16:43:12

你如何清除包括球在内的超级视图?你要删除它吗?如果是,那么您可以尝试通过将其 alpha 设置为 0 来使球不可见,而不是将其移除。

How are you clearing the superview including the ball? Are you removing it? If yes, then you could try making the ball invisible instead of removing it, by setting its alpha to 0.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文