xcode 在 uiwebview 中显示全屏 pdf
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5417946/
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
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:38:15 来源:igfitidea点击:
display full screen pdf in uiwebview
提问by Ali
I am trying to load pdf in uiwebview but the pdf be displayed with white space on the write hand side
我正在尝试在 uiwebview 中加载 pdf,但 pdf 在手写侧显示为空白
how to let be full screen displayed
如何让全屏显示
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height)];
//webView.contentMode = UIViewContentModeScaleAspectFit;
NSString *path = [[NSBundle mainBundle] pathForResource:@" manual" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
CGRect frame = webView.frame;
// you may need to modify the 5 and 10 below to match the size of the PDF border
frame.origin.x = frame.origin.x - 5;
frame.origin.y = frame.origin.y - 5;
frame.size.width = frame.size.width + 100;
frame.size.height = frame.size.height + 100;
webView.frame = frame;
[webView loadRequest:request];
[self.view addSubview:webView];
[webView release];
回答by Simon Lee
On the webview set the property scalesPagesToFit and you should be ok.
在 webview 上设置属性 scalesPagesToFit ,你应该没问题。