黑线出现在UIWebView的底部。如何清除? [英] Black line appearing at bottom of UIWebView. How to remove?

查看:304
本文介绍了黑线出现在UIWebView的底部。如何清除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个嵌入表单元格的webview中渲染一些html。由于某些原因,在webview的底部有一条黑线。我尝试将webview的背景颜色和它的scrollview设置为白色,但这没有改变任何东西。有没有人看过这个?



以下是正在呈现的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);>
波特兰开拓者vs金州勇士|全部亮点| 1月26日,
2014 | NBA 2013-14季节font-family:HelveticaNeue; font-size:12.000000; color:rgb(102,102,102); white-space:nowrap;> 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>

这是在iOS7上。



strong> UPDATE:我仍然不确定是什么导致黑线出现,但我设法通过改变我如何设置我的布局约束摆脱它。在我为视图之间的间距设置约束之前,让布局系统确定视图应该是什么大小。我改变它,以便在webview完成加载其内容时显式地设置webview的高度约束。这似乎已经解决了问题,但我还是不明白黑线来自哪里。

解决方案

strong>问题和解决方案


  1. 设置 UIWebView 不透明

  2. 设置 UIWebView的 backgroundcolor 清除 code>。

注意:上面提供的两项内容都是必要的。 b $ b

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?

Here is the HTML that is being rendered:

<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>

This is on iOS7.

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.

解决方案

I had same issue and solution is given below :

  1. Set UIWebView's opaque to NO
  2. Set UIWebView's backgroundcolor to clear color.

Note : Both things provided above are necessary.

这篇关于黑线出现在UIWebView的底部。如何清除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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