如何用两根手指而不是一根手指实现传统的 imageView-inside-a-scrollView 平移手势?
我有一个嵌套在滚动视图中的 imageView,它允许我查看图像、捏合缩放以及在放大到足够大时平移。使用自定义 GestureRecognizer,我(根据我为其构建此应用程序的人的请求)覆盖了单指平移的默认行为,以便它执行平移以外的操作。这非常有效。
现在的问题是,我仍然需要能够像用一根手指平移一样平移图像,我现在只需要用两根手指即可。是否有一个解决方案可以实现利用嵌套 imageView 的现有功能?或者我是否需要在识别两个手指手势后编写我自己的自定义泛逻辑?
非常感谢这里的任何想法!
谢谢
I have an imageView nested inside of a scrollView that allows me to view an image, pinch to zoom, and pan around if I am zoomed in enough. Using a custom GestureRecognizer, I have (per the request of the person I'm building this app for) overridden the default behavior of the one finger pan so that it does something other than pan. This works perfectly.
Now the problem is that I still need the ability to pan around the image like I could with the one finger pan, I just need this to now be with two fingers. Is there a solution that can be implemented to utilize the already available features of the nested imageView? Or do I need to go through and after the two finger gesture is recognized, write my own custom pan-logic?
Any thoughts here are greatly appreciated!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于较新版本的 iOS,您只需调整已附加到滚动视图的“默认”UIPanGenstureRecognizer 的参数
,这应该将行为“转移”到 2 手指级别
With the newer versions if iOS you can merely adjust the parameters of the 'default' UIPanGenstureRecognizer that is already attached to the scrollView
That should 'shift' the behavior to the 2 finger level