如何在 xcode 中设置 UIWebView 的初始缩放
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10810717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set initial zoom on UIWebView in xcode
提问by Ryan Stack
I'm wondering how to set an initial zoom on a PDF document loaded in a UIWebView in XCode. It is a table, and I want the web view to load zoomed in on a specific column (or part of a column which I can then scroll up and down). I've been reading and some people have pointed to this method - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
but I don't know exactly how this works.
我想知道如何在 XCode 的 UIWebView 中加载的 PDF 文档上设置初始缩放。它是一个表格,我希望 web 视图加载放大特定列(或列的一部分,然后我可以上下滚动)。我一直在阅读,有些人指出了这种方法,- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script
但我不知道它到底是如何工作的。
And while we're on the subject of PDFs, is there any way to scrape the PDF and turn it into usable strings?
当我们讨论 PDF 的主题时,有没有办法抓取 PDF 并将其转换为可用的字符串?
Edit:For reading a pdf, PDFBox is one possible solution. You have to import JAR files into your Xcode project. Here is a tutorial: http://www.oreillynet.com/pub/a/mac/2005/01/07/ipod_reader.html
编辑:对于阅读 pdf,PDFBox 是一种可能的解决方案。您必须将 JAR 文件导入到您的 Xcode 项目中。这是一个教程:http: //www.oreillynet.com/pub/a/mac/2005/01/07/ipod_reader.html
回答by Rohit Dhawan
UIWebView *webV = [[UIWebView alloc] init];
webV.scrollView.zoomScale = 4.0;