我正在使用
[scrollView_Mag setContentOffset:CGPointMake(320 * currentImageView, 0) animated:No];
这样我就可以滚动到特定的视图(根据需要)。在代码“currentImageView”是视图的编号,我想滚动。它工作得很好。唯一的问题是,例如我是320 * 10点,我想将setContent偏移量设置为320 * 2,它从点320 * 10滚动到320 * 2,从而显示所有其他的东西。我不想要的。我想让它滚动而不显示任何其他内容
答案 0 :(得分:0)
[scrollView_Mag setHidden:YES];
[scrollView_Mag setContentOffset:CGPointMake(320 * currentImageView, 0) animated:NO];
[scrollView_Mag setHidden:NO];
移动内容偏移时:
//Define this BOOL in header
isManuallyScrolling = YES;
[scrollView_Mag setHidden:YES];
[scrollView_Mag setContentOffset:CGPointMake(320 * currentImageView, 0) animated:NO];
//Use the scrollView delegate method to see when it stopped scrolling
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
//If we manually scrolled, unhide the scrollView
if (isManuallyScrolling) {
[scrollView_Mag setHidden:NO];
isManuallyScrolling = NO;
}
}