Question

After updating my code for iOS 7 I have come across one issue that continues to confuse me. This code had been working fine in iOS 6:

-(void)showPDFFile
{
NSString* fileName = @"Report.PDF";

NSArray *arrayPaths =
NSSearchPathForDirectoriesInDomains(
                                    NSDocumentDirectory,
                                    NSUserDomainMask,
                                    YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];

CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;

// This has been set to accomadate iPhone 5 screen size. //
if (iOSDeviceScreenSize.height == 568) {
    webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 455)];
}
else{
    webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 367)];
}


NSURL *url = [NSURL fileURLWithPath:pdfFileName];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView setScalesPageToFit:YES];
[webView loadRequest:request];

[self.view addSubview:webView];
} 

Since the update the webview is always ending up behind the navigation bar. I tried to change the y value to move it down but that made the code fail or have no effect. I know this is something to do with the new edge transparencies but I am not sure how to fix this. Any help would be great. Thanks

EDIT: Just to clarify I now realize this was not related to CGRectMake.

Was it helpful?

Solution

Try to change the navigayionBar translucent, it is YES by default in iOS7.

self.navigationController.navigationBar.translucent = NO;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top