I am trying to display a pdf in a UIWebview using the entire screen of the device.I have an xcode application that runs on the iPad. I have a scrollview to scroll pdf pages UIWebview is a subview of uiscrollview. The PDF is downloaded from the internet with no problems, Currently, the PDF only uses the top most half of the screen on uiwebview in portrait mode when it is displayed. I need it to span the UIWebview entire view.
NSString *strPageURL = [dictPage valueForKey:@"link"];
strPageURL = [strPageURL stringByReplacingOccurrencesOfString:@"\n" withString:@""];
strPageURL = [strPageURL stringByReplacingOccurrencesOfString:@"\t" withString:@""];
strPageURL = [strPageURL stringByReplacingOccurrencesOfString:@" " withString:@""];
NSString* strFileName = [strPageURL lastPathComponent];
NSString *strDestFile = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/%@",strFileName]];
CGRect rect = CGRectMake(xPos, 0, scrollView.frame.size.width, scrollView.frame.size.height);
UIWebView * webView = [[UIWebView alloc] initWithFrame:rect];
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[webView setContentMode:UIViewContentModeScaleAspectFit];
[webView setScalesPageToFit:YES];
webView.backgroundColor = [UIColor whiteColor];
webView.tag=3000+i;
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:strDestFile];
if(fileExists)
{
NSURL *url = [[NSURL alloc] initFileURLWithPath:strDestFile];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[webView setDelegate:self];
[scrollView addSubview:webView];
}