[英]How can I resize the uiview like that of uiimageview on uiscrollview?
I need to give functionality to user of cropping the image. 我需要为裁剪图像的用户提供功能。 I am displaying the uiimageview on a view and on that another view is being shown which is movable like a small box.on moving the box, it will give me the coordinates and as per that I will create a new image from the uiimageview. 我正在一个视图上显示uiimageview,并且正在显示另一个像小盒子一样可移动的视图。移动盒子时,它将提供我的坐标,并根据我将根据uiimageview创建一个新图像。 In such a way I am giving the functionality of a cropping Image. 我以这种方式提供了裁剪图像的功能。
Till now I was giving a fixed height width of the box to crop,But now I need to give a functionality like on 2 fingers touch,my crop box gets resized as per my fingers' position like that of ScrollviewSuite example of apple. 到现在为止,我给盒子的固定宽度是固定的,但是现在我需要提供2根手指触摸的功能,就像我的ScrollviewSuite例子一样,我的作物盒子会根据手指的位置调整大小。 I am doing following : 我正在执行以下操作:
- (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;
}
But in this manner I am just able to increase the height in static manner. 但是以这种方式,我只能以静态方式增加高度。 What should i do to fetch two finger touches and coordinates? 我该怎么做以获取两个手指触摸和坐标? Any help will be much appreciated. 任何帮助都感激不尽。 Thank you. 谢谢。
handleTwoFingerTap隐藏self.view和可见的滚动view ..意味着您必须采用一个uiview和一个scrollview ..scrollview进行缩放
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.