编辑:我有包含 uiscrollview 的控制器。该滚动视图包含自定义 uiview,其单独的类继承自 uiview。那个 uiview 有 uiimageview 作为子视图。不,我在主控制器中使用“(UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView”。但是当我缩放滚动视图时,该方法没有触发。我应该怎么做才能调用这个方法。
UIView *DrawingPlusImageView = [[UIView alloc]initWithFrame:CGRectMake((i*IMAGEVIEW_IPAD_LAND_X+112), 0, 800, 600)];
IDDrawingView *drawView = [[IDDrawingView alloc]initWithFrame:CGRectMake(0, 0, 800, 600)];
UIImageView* imgViewLand = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
[imgViewLand setImage:[UIImage imageNamed:@"noFileSelected.png"]];
[drawView setImageToDraw:imgViewLand.image];
// drawView.delegate = self;
[drawView setCurrentSlidId:hmslide.strSlideID];
[DrawingPlusImageView addSubview:imgViewLand];
[DrawingPlusImageView addSubview:drawView];
[scrollViewPresentation addSubview:DrawingPlusImageView];
drawView.userInteractionEnabled = YES;
- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView {
// Return the view that we want to zoom
return [self.scrollViewPresentation.subviews objectAtIndex:1];// there are slides, im zooming the second
}