0
votes

I'm trying to fully render a PDF in an iPad webview but the document displays too small and not the full size as to what it should be. The PDF renders perfectly on the iPhone just not the iPad webview. Please let me know if you need more information.

Main View

-(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];

}

Detail View:

    //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
You see that you're loading a storyboard with "iPhone" in the name of it, right? - nhgrif
If you set the background color of the UIWebView does it fill the whole screen? I assume it doesn't. - nhgrif

1 Answers

0
votes

You are instantiating a view controller on a storyboard whose filename has "iPhone" in it. You're probably instantiating a view controller from the wrong storyboard. Make sure you're initializing the right storyboard for the right device.