Black line appearing at bottom of UIWebView. How to remove?(UIWebView 底部出现黑线.如何去除?)
问题描述
我在嵌入在表格单元格中的 web 视图中呈现一些 html.出于某种原因,webview 底部有一条黑线.我尝试将 webview 及其滚动视图的背景颜色设置为白色,但这并没有改变任何东西.有没有人见过这个?
I am rendering some html in a webview that is embedded in a table cell. For some reason there is a black line at the bottom of the webview. I tried setting the background color of the webview and its scrollview to white but this did not change anything. Has anyone seen this before?
这是正在呈现的 HTML:
Here is the HTML that is being rendered:
这是在 iOS7 上.
This is on iOS7.
更新:我仍然不确定是什么导致了黑线出现,但我设法通过更改我设置布局约束的方式来摆脱它.在我为视图周围的间距设置约束并让布局系统确定视图的大小之前.当 webview 完成加载其内容时,我将其更改为显式设置 webview 的高度约束.这似乎已经解决了这个问题,但我仍然不明白黑线是从哪里来的.
UPDATE: I'm still not sure what is causing the black line to appear but I managed to get rid of it by changing how I setup my layout constraints. Before I was setting constraints for the spacing around the views and letting the layout system figure out the size that the view should be. I changed it to explicitly set a height constraint of the webview when the webview finishes loading its content. This seems to have fixed the issue but I still do not understand where the black line was coming from.
推荐答案
我有同样的问题,解决方案如下:
- 设置
UIWebView的
opaque
为NO
- 将
UIWebView的
backgroundcolor
设置为clear
color
.
- Set
UIWebView's
opaque
toNO
- Set
UIWebView's
backgroundcolor
toclear
color
.
注意:以上提供的两件事都是必需的.
使用上述方案时的其他解决方案
或
HTML 头部标签中的元数据
The meta to go in the head tag of HTML
这篇关于UIWebView 底部出现黑线.如何去除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!