iOS:切换到横向模式时Webview不缩放

时间:2012-01-28 00:30:22

标签: ios uiwebview orientation scaling

自升级到Xcode 4.2后,当我更改方向时,Web视图无法正确缩放

我使用此代码:

NSLog(@"Show link: %@",URL);

[showStory loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:URL]]];

showStory.scalesPageToFit = YES;

showStory.contentMode = UIViewContentModeScaleAspectFit;

但是当我切换到横向模式时会发生这种情况。有什么建议吗?

enter image description here

2 个答案:

答案 0 :(得分:3)

Try this

 webView.scalesPageToFit = YES;
        webView.contentMode = UIViewContentModeScaleToFill;
        webView.multipleTouchEnabled = YES;
        webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        [self.view addSubview:webView];

答案 1 :(得分:0)

您需要勾选缩放页面以适合webView属性检查器中的选项。