Objective c 目标C:正确缩放UIScrollView
每当缩放视图时,我的滚动视图都会出现问题。 当我缩放视图时,它会自动定位在左上角。我想做的是视图在移动后保持在它所定位的位置 这是我的密码:Objective c 目标C:正确缩放UIScrollView,objective-c,ios,uiscrollview,Objective C,Ios,Uiscrollview,每当缩放视图时,我的滚动视图都会出现问题。 当我缩放视图时,它会自动定位在左上角。我想做的是视图在移动后保持在它所定位的位置 这是我的密码: mainSV = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)]; [mainSV setPagingEnabled:YES]; [mainSV setDelegate:self]; [mainSV setShowsVerticalScroll
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
,它保存我的应用程序中的所有图像。问题是由InnerSV
滚动视图页面造成的。
如果将其设置为FALSE,它应该可以工作
干杯 虚假作品为我“不”制造了一些问题,非常感谢