2012-05-21 62 views
1

我使用- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event觸法imageView,但我已imageViewscrollview這就是爲什麼觸摸事件不執行,因爲它是以直接滾動型如何在scrollview下做imageView touch事件?

我的代碼是

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
{ 
    // get touch event 
    UITouch *touch = [[event allTouches] anyObject]; 
    CGPoint touchLocation = [touch locationInView:self.view]; 

    if ([touch view] == imagedisplay) { 
     // move the image view 
     imagedisplay.center = touchLocation; 
    } 


} 

imagedisplay我的ImageView對象,但在不工作觸摸事件我有scrollview在拍攝imageView工作,所以給任何解決方案和源代碼相關的觸摸適用於scrollview和imageView

回答

0

使用下面的代碼,您正在創建imageView-

imageView.userInteractionEnabled = YES; 

因爲它是NO默認。

相關問題