方法: 手势识别+图形转换
Code:
CGFloat _width=[self getPixCountWithmmL:40];
CGFloat _height=[self getPixCountWithmmL:20];
UITextView *_textView = [[UITextView alloc] initWithFrame:CGRectMake(0, 20, _width, _height)];
_textView.text = @"中国人";
[_textView setBackgroundColor:[UIColor purpleColor]];
UIView *_tmpview = [[UIView alloc] initWithFrame: CGRectMake(0, 50, 320, 500)];
[_tmpview addSubview:_textView];
[_tmpview setBackgroundColor:[UIColor lightGrayColor]];
[self.view addSubview:_tmpview];
self.centerPoint=_tmpview.center;
[_tmpview setAutoresizingMask:UIViewAutoresizingFlexibleTopMargin];
UIPinchGestureRecognizer *pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
[_tmpview addGestureRecognizer:pinchGestureRecognizer];
- (void) handlePinch:(UIPinchGestureRecognizer*) recognizer
{
NSLog(@"捏合, %f", recognizer.scale);
recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
recognizer.view.frame = CGRectMake(0, 50, recognizer.view.frame.size.width, recognizer.view.frame.size.height);
recognizer.scale = 1;
}