2011-12-03 68 views
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; 
} 

但是,在這種方式,我只是能夠以靜態方式增加高度。我應該怎樣做才能獲取兩個手指觸摸和座標?任何幫助都感激不盡。謝謝。

回答

0

handleTwoFingerTap隱藏self.view和可見滾動視圖...意味着你必須採取一個uiview和一個滾動視圖..scrollview縮放

相關問題