如何检测手势与捏出手势的捏? [英] How to detect pinch in gesture vs pinch out gesture?

查看:145
本文介绍了如何检测手势与捏出手势的捏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

而不是缩放,我认为通常会使用捏合手势,我只是想检测是否捏是捏缩进,因此我可以折叠或扩展一些表格部分。我该怎么做?

Instead of scaling, which I think pinch gesture is usually used for, I am looking to just detect whether the pinch was a pinch in vs pinch out so I can collapse or expand some table sections. How would I go about doing that?

推荐答案

嗯,这看起来很简单。 UIPinchGestureRecognizer 只有两个属性 scale velocity 。似乎合乎逻辑的是,负比例意味着向内捏合,正向比例向外捏合。

Well, that seems an easy one. The UIPinchGestureRecognizer class has only two properties, scale and velocity. It seems logical that a negative scale would mean an inward pinch, a positive scale an outward pinch.

注意:否定可能会产生误导。 较小是 0.0<规模< 1.0 ,更大是 scale> 1.0

NB: "negative" might be misleading. "Smaller" is 0.0 < scale < 1.0, "bigger" is scale > 1.0.

这篇关于如何检测手势与捏出手势的捏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆