我正在尝试在iPad webview中完全呈现PDF,但文档显示的太小而不是它应该是什么的完整大小。 PDF在iPhone上完美呈现,而不是iPad webview。如果您需要更多信息,请与我们联系。
主视图
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//NSString *url = [chapterFiles objectAtIndex:indexPath.row];
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource: [chapterFiles objectAtIndex:indexPath.row] ofType:@"pdf"]];
NSLog(@"Selected File: %@",url);
//transfer selected
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil];
chapterDetailViewController *detailView = (chapterDetailViewController *)[sb instantiateViewControllerWithIdentifier:@"chapterDetails"];
detailView.url = url;
[self.navigationController pushViewController:detailView animated:YES];
}
详情视图:
//NSString *path = [[NSBundle mainBundle] pathForResource:url ofType:@"pdf"];
//NSURL *targetURL = [NSURL fileURLWithPath:url];
NSURLRequest *siteRequest = [NSURLRequest requestWithURL:url];
[chapterWebView loadRequest:siteRequest];
chapterWebView.delegate = self;
//[chapterWebView setScalesPageToFit:YES];
chapterWebView.scalesPageToFit = YES;
// chapterWebView.contentMode = UIViewContentModeScaleToFill;
// chapterWebView.multipleTouchEnabled = YES;
// chapterWebView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
// [self.view addSubview:chapterWebView];
}
答案 0 :(得分:0)
您正在故事板上实例化一个视图控制器,其文件名为" iPhone"在里面。您可能从错误的故事板中实例化视图控制器。确保您为正确的设备初始化正确的故事板。