UIwindow 上的 UIimageView 上的触摸事件
我在 UIWindow 之上使用 UIimageview。我想处理该 Imageview 的触摸事件,但我无法做到。
当我在UIview上使用UIimageView时,我们可以使用touchBegan,touchEnded,但是当它在UIWindow而不是UIView上时如何处理它。
谢谢..
I m using UIimageview on top of UIWindow. I want to handle touch event for that Imageview, but m not able to do it.
When i use UIimageView on UIview, we can use touchBegan, touchEnded but how to handle it when it is on UIWindow instead of UIView.
Thanks..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只想处理点击,则必须设置,
默认情况下UIImageView将userInteractionEnabled属性设置为NO。并且您可以向其添加点击手势识别器,
如果您想移动图像,可以使用UIPanGestureRecognizer。
If you just want to handle the tap, you have to set,
By default UIImageView has the userInteractionEnabled property set to NO. And you can add a tap gesture recognizer to it,
If you want to move the image, you can use UIPanGestureRecognizer.
试试这个功能
try this function