- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSString *path = [[NSBundle mainBundle] pathForResource:@"About" ofType: @"pdf"];
NSLog(@"%@", path);
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[_webView loadRequest:request];
}
答案 0 :(得分:0)
在网络视图中使用以下代码打开PDF
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"About" ofType:@"pdf"];
[self.webVctr loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filePath]]];
并查看PDF是否存在?
这认为可能有助于你
快乐编码..
答案 1 :(得分:0)
试试这个:
中的
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, 200, 200)];
NSString *path = [[NSBundle mainBundle] pathForResource:@"About" ofType:@"pdf"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[webView loadRequest:request];
[self.view addSubview:webView];
[webView release];
答案 2 :(得分:0)
这是与网页视图上的pdf加载无关的其他一些问题。我交叉检查并找到了崩溃的实际原因。无论如何,谢谢你的帮助