在 Scroll-View 中有一个 Child-View 并在 Scroll on Top、Left、Right 中遇到问题?
在子子视图中添加捏合和缩放的代码
UIPinchGestureRecognizer *twoFingerPinch = [[[UIPinchGestureRecognizer alloc]
initWithTarget:self
action:@selector(twoFingerPinch:)]
autorelease];
[_childView addGestureRecognizer:twoFingerPinch];
捏和缩放子视图的方法
- (void)twoFingerPinch:(UIPinchGestureRecognizer *)recognizer
{
//NSLog(@"Pinch scale: %f", recognizer.scale);
CGAffineTransform transform = CGAffineTransformMakeScale(recognizer.scale, recognizer.scale);
// you can implement any int/float value in context of what scale you want to zoom in or out
_childView.transform = transform;
_scrollView.contentSize =
CGSizeMake(_scrollView.frame.size.width,_childView.frame.size.height);
}
Scroll-View ContentSize 设置有什么问题吗?
这是我的代码
谢谢