【问题标题】:iPad PDF Rendering too small. Not to screen sizeiPad PDF 渲染太小。不是屏幕大小
【发布时间】:2014-05-25 22:58:48
【问题描述】:

我正在尝试在 iPad 网络视图中完全呈现 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];

}

【问题讨论】:

  • 您看到您正在加载一个名称为“iPhone”的情节提要,对吧?
  • 如果你设置UIWebView的背景颜色会填满整个屏幕吗?我认为不会。

标签: ios objective-c ipad pdf


【解决方案1】:

您正在故事板上实例化一个视图控制器,其文件名中包含“iPhone”。您可能正在从错误的情节提要中实例化视图控制器。确保为正确的设备初始化正确的故事板。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-02-07
    • 1970-01-01
    • 2020-10-22
    • 2022-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多