将 UIPanGestureRecognizer 添加到 UIView
我有 2 个 UIView;我们称它们为 mainView 和 otherView。 mainView 使用整个屏幕(它是一个 iPad 应用程序),而 otherView 是一个较小的屏幕,显示在 mainView 之上。问题是我不知道如何以及在哪里添加 UIPanGestureRecognizer。我找到的代码片段显示了代码,但它从来都不清楚(或者我不确定为什么它永远不起作用)。
大多数时候,我收到“otherView 可能无法响应 +addGestureRecognizer”警告,我尝试在几乎所有头文件中添加 UIGestureRecognixerDelegate,但我不知道我做错了什么。
希望你能帮助我:)
I have 2 UIViews; let's call'em mainView and otherView. mainView uses the whole screen (it is an iPad app) and otherView is a smaller one that appears on top of mainView. The problem is that I don't know how and where to add the UIPanGestureRecognizer. The code snippets I find shows the code, but its never clear (or I'm not sure why it never works).
Most of the time I get a "otherView may not respond to +addGestureRecognizer" warning, I've tried adding the UIGestureRecognixerDelegate in practically all headers file and I don't know what I'm doing wrong.
Hope you can help me out :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
addGestureRecognizer
不是一个类方法,它是一个实例方法。除此之外,没有代码我就无话可说了。另外,请查看 CS193P 第 8 讲:手势识别器。 iTunes 链接
addGestureRecognizer
is not a class method, it's an instance method. Other than that, without code there's not much I can say.Also, check out CS193P Lecture 8: Gesture Recognizers. iTunes Link