从代码启动 UIGestureRecognizer
我有一个带有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你如何清除包括球在内的超级视图?你要删除它吗?如果是,那么您可以尝试通过将其 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.