UIWebview:不旋转,不调整大小以适应整个屏幕

Ant*_*ong 4 uiwebview ios xcode4

测试代码可在此处获取您的评论.

1)轮换问题:

我已经实施了

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

在WebViewController.m文件中,但它仍然不会旋转.(见下图)

肖像

景观

2)尺寸问题

正如您在图片中看到的那样,屏幕的底部是空白的(约占屏幕的25%).我检查了xib文件,UIWebView似乎设置正确

我犯了很明显的错误吗?

rai*_*ade 5

您没有在应用程序委托中保留Web视图的视图控制器.

要修复替换,

[self.window addSubview:wvc.view] -> [[self window] setRootViewController:wvc];
Run Code Online (Sandbox Code Playgroud)