1
我使用- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
觸法imageView
,但我已imageView
下scrollview
這就是爲什麼觸摸事件不執行,因爲它是以直接滾動型如何在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