简体   繁体   English

iPhone - 改变视图后面的UIWebView背景颜色(弹跳背景)

[英]iPhone - changing UIWebView background color behind the view (bouncing background)

I have a UIWebView with a black content. 我有一个黑色内容的UIWebView。 All my views and subviews are set to black background. 我的所有视图和子视图都设置为黑色背景。

When scrolling the webView to its top or bottom position, I can see a white background appear while the content is bouncing. 当将webView滚动到其顶部或底部位置时,我可以看到在内容弹跳时出现白色背景。 So how may I force that background also to be black ? 那我怎么强迫那个背景也是黑色的呢?

Set webview color to clearcolor add then webview opaque to no . webview color设置为clearcolor add,然后将webview opaqueno

webview.backgroundColor = [UIColor clearcolor];
webview.opaque=NO;

That will do the trick. 那就行了。

Are you sure all your subviews are set to black? 您确定所有子视图都设置为黑色吗? Setting the webview's background color to black should work just fine. 将webview的背景颜色设置为黑色应该可以正常工作。 (It works in my app, if it doesn't work for you, I'll have to check if I do something else...) (它适用于我的应用程序,如果它对你不起作用,我将不得不检查我是否做了其他的事情......)

webview.backgroundColor = [UIColor blackColor];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM