0

ビューをズームするたびに、スクロールビューに問題があります。ビューをズームすると、自動的に左上隅に配置されます。私がやりたいのは、移動したら配置された場所にとどまるビューです。

これが私のコードです:

    mainSV = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
    [mainSV setPagingEnabled:YES];
    [mainSV setDelegate:self];
    [mainSV setShowsVerticalScrollIndicator:NO];
    [mainSV setShowsHorizontalScrollIndicator:NO];
    [mainSV setScrollEnabled:YES];
    [mainSV setUserInteractionEnabled:YES];
    [mainSV setMaximumZoomScale:2.0];
    [mainSV setMinimumZoomScale:1.0];
    [mainSV setMultipleTouchEnabled:YES];
    [mainSV setClipsToBounds:YES];
    [mainSV setContentSize:CGSizeMake(768, 1024)];
    [self.view addSubview:mainSV];

    innerSV = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
    [innerSV setPagingEnabled:YES];
    [innerSV setDelegate:self];
    [innerSV setShowsVerticalScrollIndicator:NO];
    [innerSV setShowsHorizontalScrollIndicator:NO];
    [innerSV setScrollEnabled:YES];
    [innerSV setUserInteractionEnabled:YES];
    [innerSV setClipsToBounds:YES];
    [innerSV setContentSize:CGSizeMake(768*numOfPages, 1024)];
    [mainSV addSubview:innerSV];

- (UIView*)viewForZoomingInScrollView:(UIScrollView *)aScrollView {

    return innerSV;
}

InnerSV はUIScrollView、アプリ内のすべての画像を保持するものでもあります。

4

1 に答える 1

1

innerSVこの問題は、スクロールビューのページングによって発生します。FALSE に設定すると、機能するはずです。

乾杯!

于 2012-10-12T06:53:06.827 に答える