A black line appears at the bottom of the UIWebView. How to delete?

I am showing 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 webpage. I tried setting the background color of the webview and its scrollview to white, but that didn't change anything. Has anyone seen this before? UIWebView with black line at bottom

Here is the HTML that displays:

<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 causes the black line, but I managed to get rid of it by changing the way I set my layout restrictions. Before I set limits on the distance around the views and let the layout system determine the size that should be the view. I modified it to explicitly set the height limit of the webview when the webview finishes loading the content. This seems to fix the problem, but I still don't understand where the black line comes from.

+50
html css ios uiwebview
Jan 29 '14 at 1:05
source share
1 answer

I had the same problem and the solution is given below:

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

Note. Both of the things mentioned above are necessary.




Other solutions when using above one

 webView.scrollView.backgroundColor = UIColor.whiteColor() 

OR

Meta to go to the HTML tag header

 <meta name="viewport" content="initial-scale=1, maximum-scale=1"> 
+178
May 2 '14 at 12:13
source share



All Articles