1. UIPinchGestureRecognizer(捏合)基本介绍
2. UIPinchGestureRecognizer应用举例
- (void)setUpPinch
{
// 捏合
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
pinch.delegate = self;
[self.imageView addGestureRecognizer:pinch];
}
- (void)pinch:(UIPinchGestureRecognizer *)pinch
{
NSLog(@"%f",pinch.scale);
self.imageView.transform = CGAffineTransformScale(self.imageView.transform, pinch.scale, pinch.scale);
// 复位
pinch.scale = 1;
}
3. UIPinchGestureRecognizer属性
// 伸缩比例
@property (nonatomic) CGFloat scale;
// 伸缩速度
@property (nonatomic,readonly) CGFloat velocity;