我有一個UIScrollView作爲子視圖,它又有一個UIImageView作爲其子視圖的UIView。我也可以放大。但是我想在雙擊時調用另一個功能。即時通訊使用此代碼:在調用函數的問題
- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view
{
if(view == scrollView)
{
UITouch *touch = [touches anyObject];
if([touch tapCount]== 2)
{
[self setViewForProductDispaly];
return YES;
}
}
return NO;
}
地,上述方法沒有得到當我點擊it.What可能是這個振振有辭調用。
我的滾動視圖
scrollView.hidden=NO;
scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0, 0.0,self.bounds.size.width,self.bounds.size.height)];
scrollView.maximumZoomScale = 3.0;
scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack;
scrollView.delegate =self;
scrollView.bouncesZoom = YES;
scrollView.delaysContentTouches=NO;
bigImageView.autoresizesSubviews = YES;
bigImageView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
bigImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0.0, 0.0, bigImg.size.width, bigImg.size.height)];
bigImageView.image = bigImg;
bigImageView.userInteractionEnabled = YES;
[scrollView addSubview:bigImageView];
[bigImageView release];
[self addSubview:scrollView];
[scrollView release];
這也是我的第一個猜測。您可以通過在整個代碼中放置NSLog語句來驗證這一點,以查看執行的內容。試試:if(view == bigImageView) – ader