Black bar appearing in UIWebview when device orientation changes

北战南征 提交于 2019-12-02 19:17:01

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.

I had the same problem, and simply setting opaque to NO fixed it. Didn't even have to change the background color, it works fine with the background color set to white.

I put in the line...

webView.scrollView.backgroundColor = UIColor.whiteColor()

webView is my @IBOutlet weak var webView: UIWebView!

iosdev1111

Turn off WebKitDiskImageCacheEnabled and the black border goes away :
In applicationDidFinishLaunchingWithOptions add the following lines :

[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDiskImageCacheEnabled"];
[[NSUserDefaults standardUserDefaults] synchronize];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!