[英]How can I resize the uiview like that of uiimageview on uiscrollview?
我需要為裁剪圖像的用戶提供功能。 我正在一個視圖上顯示uiimageview,並且正在顯示另一個像小盒子一樣可移動的視圖。移動盒子時,它將提供我的坐標,並根據我將根據uiimageview創建一個新圖像。 我以這種方式提供了裁剪圖像的功能。
到現在為止,我給盒子的固定寬度是固定的,但是現在我需要提供2根手指觸摸的功能,就像我的ScrollviewSuite例子一樣,我的作物盒子會根據手指的位置調整大小。 我正在執行以下操作:
- (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;
}
但是以這種方式,我只能以靜態方式增加高度。 我該怎么做以獲取兩個手指觸摸和坐標? 任何幫助都感激不盡。 謝謝。
handleTwoFingerTap隱藏self.view和可見的滾動view ..意味着您必須采用一個uiview和一個scrollview ..scrollview進行縮放
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.