iOS手势篇(六)-UIPinchGestureRecognizer详解

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_18683985/article/details/83619088

UIPinchGestureRecognizer(捏合手势).是iOS中的一个比较常见的手势,具体在系统应用的相册、微信应用图库等地方用到了.使用上.也比较简便,整个.h文件里头就只有俩属性.

// Begins:  when two touches have moved enough to be considered a pinch
// Changes: when a finger moves while two fingers remain down
// Ends:    when both fingers have lifted
@property (nonatomic)          CGFloat scale;               // scale relative to the touch points in screen coordinates
@property (nonatomic,readonly) CGFloat velocity;            // velocity of the pinch in scale/second

当两只手指在屏幕上移动了指定的距离的时候就手势识别就成功了.到了开始状态.
当两只手指保持在屏幕上并且正在移动的时候就是改变的状态
两只手指都离开屏幕的时候手势识别就结束了

属性 默认值 说明
scale 0.0 这个是两根手指相对位置的值,一般不需要手动设置,如果手动设置了.那么velocity(速率)的值会被重置为0.而且,这个值是不需要我们进行累加计算的.
velocity 0.0 注意这个属性是readonly只读的,这个属性反应了捏合的速率手指靠近是负值,手指相离是正值

猜你喜欢

转载自blog.csdn.net/qq_18683985/article/details/83619088