MonoTouch:如何向 UIPageViewController 添加两指手势识别器?
具有 PageCurl 过渡的 UIPageViewController 非常适合模拟页面,但默认的 GestureRecognizer (UIPanGestureRecognizer) 仅响应一根手指事件。我想在其他事件之上添加一个两指事件。
如何向当前 UIPageViewController 实例添加另一个 PanGestureRecognizer?这个新的 PanGestureRecognizer 应等待两个手指平移触摸,而不禁用原始的 UIPanGestureRecognizer。
我所需要的只是一种方法,如果用户用两根手指而不是一根手指滚动页面,但它仍然应该像调用单指事件一样滚动页面。
我怎样才能在 MonoTouch 中做到这一点?
提前致谢。
The UIPageViewController with the PageCurl transition is great for simulate pages, but the default GestureRecognizer (UIPanGestureRecognizer) is only responding to one finger events. I want to add a two finger event above the others.
How to add another PanGestureRecognizer to the current UIPageViewController instance? This new PanGestureRecognizer should wait for two fingers pan touches, without disabling the original UIPanGestureRecognizer.
All I need is a way to rise an additional custom event if the user scroll the pages with two fingers instead of one, but it should still scroll the pages like the one finger event was called.
How can I do this in MonoTouch?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己解决了这个问题。 UIPageViewController 包含一组手势识别器。第一个是我们需要获取的,将其“MaximumNumberOfTouches”属性从 1 更改为 2。代码如下:
然后,在处理翻页事件的代码中(在我的例子中是继承“UIPageViewControllerDataSource”的自定义类)您可以通过以下方式访问当前的触摸次数:
并使用该值进行相应的操作。
I solved the issue myself. The UIPageViewController contains an array of gesture recognizers. The first one is the one we need to get, changing its "MaximumNumberOfTouches" property from 1 to 2. Here is the code:
Then, inside your code handling the page turn event (in my case a custom class inheriting the "UIPageViewControllerDataSource") you can access the current number of touches with:
and use this value to act accordingly.