我在 ScrollView 中加载了一个 pdf,我想直接转到下一页而不需要动画滚动。
CGRect scrollViewRect = CGRectInset(viewRect, -scrollViewOutset, 0.0f);
theScrollView = [[UIScrollView alloc] initWithFrame:scrollViewRect]; // All
theScrollView.autoresizesSubviews = NO;
theScrollView.contentMode = UIViewContentModeRedraw;
theScrollView.showsHorizontalScrollIndicator = NO;
theScrollView.showsVerticalScrollIndicator = NO;
theScrollView.scrollsToTop = NO;
theScrollView.delaysContentTouches = NO;
theScrollView.pagingEnabled = YES;
theScrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
theScrollView.backgroundColor = [UIColor clearColor];
theScrollView.delegate = self;
[self.view addSubview:theScrollView];
这可能吗?
最佳答案
您必须使用以下方法通过以下方法跳转到下一页的直接偏移。
[objUIScrollView setContentOffset:CGPointMake(YOUR_X, YOUR_Y) animated:NO]
animated = NO;
如果您通过 WebView 加载 PDF,则需要遵循以下代码:
webview.scrollView.contentOffset = CGPointMake(YOUR_X, YOUR_Y);
Note : Use this above code in your Next Button page or after loading
WebView
properly may be in below method.
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
}
希望这会像您预期的那样工作。
关于ios - 如何在 Objective C 的 UIScrollView 中禁用动画滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41696518/