iphone viewForZoomingInScrollView未调用

Rah*_*diq 7 iphone uiscrollview ipad

编辑:我有包含uiscrollview的控制器.该scrollview包含自定义uiview,其独立的类继承自uiview.该uiview将uiimageview作为子视图.不,我正在主控制器中"(UIView*)viewForZoomingInScrollView :( UIScrollView*)scrollView".但是当我缩放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
}
Run Code Online (Sandbox Code Playgroud)

Moh*_*sim 20

我遇到了同样的问题.并设置ScrollView的最小和最大缩放级别解决了我的问题..

self. scrollViewPresentation.minimumZoomScale = 1.0;
self. scrollViewPresentation.maximumZoomScale = 10.0;
Run Code Online (Sandbox Code Playgroud)