设备方向更改时,UIWebview中出现黑条 [英] Black bar appearing in UIWebview when device orientation changes

查看:109
本文介绍了设备方向更改时,UIWebview中出现黑条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIWebView,我正在加载到另一个视图上,旋转时外观在纵向或横向看起来很好,但是当我在肖像时,当我从纵向旋转到横向视图时,我用捏或双击轻微放大dosnt完全用uiwebview填充,右边大约有10pxls,如本屏幕截图所示,变成黑色。

I have a UIWebView that I am loading onto another view, everthing looks fine in portrait or landscape when rotating, however when I am in portrait and I zoom in slightly with pinch or double tap when I rotate from portrait to landscape the view dosnt fill completely with the uiwebview, there are about 10pxls on the right that turn black as outlined in this screen shot.

如果仔细观察,可以看到黑色滚动指示器的轮廓,这是uiwebview的一部分?如果是这样,那么为什么它会在这个区域变黑。

if you look carefully you can see the outline of the scroll indicator in the black, which segests this is part of the uiwebview?? if so then why dose it turn black in this area.

另外还有另一个webview的屏幕截图向上滚动升技,这样你就可以看到它的部分uiwebview ...

Also heres another screen shot of the webview scrolled up abit so you can see its part of the uiwebview...

这就是我将视图添加到详细视图的方式。

This is how I am adding the view onto the detail view.

- (void)viewdidload
//..

//Load in FirstView
    firstView = [[FirstMainViewController alloc] init];
    firstView.view.frame = CGRectMake(0.0, 0.0, firstView.view.bounds.size.width, firstView.view.bounds.size.height);

    firstView.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    firstView.view.backgroundColor = [UIColor whiteColor];

    [self.view insertSubview:firstView.view belowSubview:actionTabBar]; 

//..


推荐答案

尝试设置webView透明(clearColor)的背景,并将其opaque属性设置为FALSE。然后在html中将背景设为白色,或者只是将视图放在webView白色下面。

Try to set the background of the webView transparent (clearColor) and set it's opaque property to FALSE. Then make the background white in your html or simply have the view beneath the webView white.

这篇关于设备方向更改时,UIWebview中出现黑条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆