问题描述
而不是缩放,我认为通常会使用捏合手势,我只是想检测是否捏是捏缩进,因此我可以折叠或扩展一些表格部分。我该怎么做?
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?
推荐答案
嗯,这看起来很简单。 类只有两个属性, 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
.
这篇关于如何检测手势与捏出手势的捏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!