我有一个 UIWebView,它加载以横向格式设置的 PDF,并且在 iPhone 屏幕上很难阅读。我的代码是这样的:
- (void)viewWillAppear:(BOOL)animated {
NSURL *url = [NSURL URLWithString:_entry.articleUrl];
NSLog(@"%@",url);
[_webView loadRequest:[NSURLRequest requestWithURL:url]];
self.title = _entry.articleTitle;
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];
}
有哪些方法可以将其设置为放大并可能移至顶部 pdf 页面的右侧?
最佳答案
首先确保您的 UIWebView 已启用 scalesPageToFit 属性
self.myWebView.scalesPageToFit = YES;
然后在 HTML 中的“head”标签内添加此标签
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
您可以设置maximum-scale=1.5(如果这样可以使其看起来更好)。
我不确定它是否是 PDF 文件,如何向其中添加这些标签。也许您可以添加标签并在 html 文件中实现 PDF。
以下是如何在 HTML 中嵌入 PDF 文件
<embed src="filename.pdf" width="500" height="375">
祝你好运!
关于iphone - 出现时放大网页 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10998252/