0
我需要为剪裁图像的用户提供功能。我在视图上显示uiimageview,并显示另一个视图,它像一个小盒子一样可移动。在移动盒子时,它会给我坐标,并根据该图像从uiimageview创建一个新图像。以这种方式,我正在给出裁剪图像的功能。直到现在,我给框的固定高度宽度的裁剪,但现在我需要给一个功能,如2个手指触摸,我的裁剪框被调整为我的手指的位置像ScrollviewSuite的例子苹果。我正在做:如何在uiscrollview上调整像uiimageview那样的uiview?
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
NSUInteger tapCount = [touch tapCount];
UITapGestureRecognizer *twoFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerTap:)];
[twoFingerTap setNumberOfTouchesRequired:2];
[newView addGestureRecognizer:twoFingerTap];
CGPoint touchLocation = [touch locationInView:self.view];
oldX = touchLocation.x;
oldY = touchLocation.y;
}
- (void)handleTwoFingerTap:(UIGestureRecognizer *)gestureRecognizer
{
CGRect frame = newView.frame; \\newframe is the crop box
frame.size.height += 100;
newView.frame = frame;
}
但是,在这种方式,我只是能够以静态方式增加高度。我应该怎样做才能获取两个手指触摸和坐标?任何帮助都感激不尽。谢谢。