0
我在縮放視圖時遇到了滾動視圖問題。 當我放大視圖時,它會自動定位在左上角。我想要做的就是將視圖保留在移動後的位置。Objective C:正確縮放UIScrollView
這裏是我的代碼:
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
保存在我的應用程序的所有圖像。
FALSE對我來說 「否」發生了一些問題 非常感謝 –