【发布时间】:2013-10-05 20:12:47
【问题描述】:
在为 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 无关。
【问题讨论】:
标签: ios uiwebview ios7 cgrectmake