iPad PDF渲染太小。不是屏幕尺寸

时间:2014-05-25 22:58:49

标签: ios objective-c ipad pdf

我正在尝试在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];

}

1 个答案:

答案 0 :(得分:0)

您正在故事板上实例化一个视图控制器,其文件名为" iPhone"在里面。您可能从错误的故事板中实例化视图控制器。确保您为正确的设备初始化正确的故事板。