在为 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 无关。