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对我来说 “否”发生了一些问题 非常感谢 –