当使用UIPinchGestureRecognizer时,在水平和垂直方向分别检测/读取夹量秤的最佳方法是什么?我看到了这个帖子
UIPinchGestureRecognizer Scale view in different x and y directions
但我注意到有这么多人来回这样一个看似例行的任务,我不确定这是最好的答案/方式。
如果不使用UIPinchGestureRecognizer完全用于此目的是答案,那么在两个不同方向上检测捏秤的最佳方法是什么?
当使用UIPinchGestureRecognizer时,在水平和垂直方向分别检测/读取夹量秤的最佳方法是什么?我看到了这个帖子
UIPinchGestureRecognizer Scale view in different x and y directions
但我注意到有这么多人来回这样一个看似例行的任务,我不确定这是最好的答案/方式。
如果不使用UIPinchGestureRecognizer完全用于此目的是答案,那么在两个不同方向上检测捏秤的最佳方法是什么?
3条答案
按热度按时间zed5wv101#
基本上做到这一点,
这个函数会返回H,V,D给你。水平、垂直、对角线。
你可以这样用它...
fruv7luv2#
在我的C#中,我做了以下事情
我计算捏“开始”时两点之间的距离,并将该值保存在两个私处。然后,我根据第一个测量距离和第二个(在“changed”中)计算缩放(fontScaling)。我使用我自己的视图(_previewView)设置为base(100%),但是你可以使用View.bounds.height或者width来代替。在我的例子中,我总是有一个正方形视图,所以在我的应用程序中高度==宽度。
wecizke33#
使用此扩展(基于先前的答案)。