CGRectMake已经移动到我的导航栏后面

时间:2013-09-30 03:47:33

标签: ios uiwebview ios7 cgrectmake

更新我的iOS 7代码后,我遇到了一个让我感到困惑的问题。这段代码在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];
} 

自更新以来,webview始终位于导航栏后面。我试图更改y值以将其向下移动,但这会导致代码失败或无效。我知道这与新的边缘透明胶片有关,但我不知道如何解决这个问题。任何帮助都会很棒。感谢

编辑: 只是为了澄清我现在意识到这与CGRectMake无关。

1 个答案:

答案 0 :(得分:6)

尝试更改导航栏translucent,默认情况下在iOS 7中为YES

self.navigationController.navigationBar.translucent = NO;