出现在UIWebView底部的黑线.怎么删除?

How*_*ack 52 html css uiwebview ios

我在嵌入在表格单元格中的webview中呈现一些html.出于某种原因,webview底部有一条黑线.我尝试将webview的背景颜色及其scrollview设置为白色,但这并没有改变任何东西.谁看过这个吗?UIWebView底部带有黑色线条

这是正在呈现的HTML:

<html>
<head>

    <style type="text/css">
a {text-decoration:none;background-color:white;}
    </style>

    <title></title>
</head>

<body style="margin:0;padding:0;background-color:white;">
    <a href="http://body/" style=
    "font-family:HelveticaNeue-Light;font-size:20.000000;color:black;-webkit-tap-highlight-color:rgba(0,0,0,0);">
    Portland Blazers vs Golden State Warriors | FULL Highlights | January 26 ,
    2014 | NBA 2013-14 Season</a><span style=
    "font-family:HelveticaNeue;font-size:12.000000;color:rgb(102,102,102);white-space:nowrap;"><a href="https://www.youtube.com/watch?v=2TfldZ4w57E&amp;feature=youtube_gdata_player"
    style=
    "font-family:HelveticaNeue;font-size:12;color:rgb(102,102,102);-webkit-tap-highlight-color:rgba(0,0,0,0);"><img height="12"
    src="file:link@2x.png" width="20">www.youtube.com</a></span>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是在iOS7上.

更新:我仍然不确定是什么导致黑线出现但我设法通过改变我设置布局约束的方式摆脱它.在我为视图周围的间距设置约束并让布局系统确定视图应该是的大小之前.当webview完成加载其内容时,我将其更改为显式设置webview的高度约束.这似乎解决了这个问题,但我仍然不明白黑线的来源.

Par*_*iya 182

我有同样的问题,解决方案如下:

  1. 设置UIWebView's opaqueNO
  2. 设置UIWebView's backgroundcolorclear color.

注意:上面提供的两件事都是必要的.

  • 能够摆脱黑线,`opaque`设置为`NO`和`backgroundColor`设置为[UIColor whiteColor]`(如果我注释掉`backgroundColor`line我也看不到黑线) (2认同)
  • 就我而言,`UIWebView`已经具有白色背景色。只需将其“不透明”设置为“否”即可使用。 (2认同)