在uiwebview中显示全屏pdf
我正在尝试在 uiwebview 中加载 pdf,但 pdf 在写手侧显示有空白
如何让全屏显示
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];
I am trying to load pdf in uiwebview but the pdf be displayed with white space on the write hand side
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在网络视图上设置属性scalesPagesToFit,你应该没问题。
On the webview set the property scalesPagesToFit and you should be ok.