Margin on youtube iframe on iOS

I have UIWebViewwith the following code:
<iframe class="youtube-player" type="text/html" width="320" height="180" src="http://www.youtube.com/embed/OsSZ4u7Sz6s" frameborder="0"></iframe>

The fact is that the video preview is a few pixels (see image)

I checked using recursiveDescriptionItself UIWebViewis in the right place (0,0,320,180)

How can I do it tough? enter image description here

Edit :
Apparently, this also happens on Vimeo iframe, since the problem is not in youtube-specific, but in the specific iframe

+4
source share
2 answers

Fields and pads must be reset.

NSString *yourHtml = @"<html><head><title>.</title><style>body,html,iframe{margin:0;padding:0;}</style></head><body><iframe width=\"100%%\"  height=\"250\" src=\"http://www.youtube.com/embed/OsSZ4u7Sz6s\" frameborder=\"0\" allowfullscreen></iframe></body></html>";
[self.webView loadHTMLString:yourHtml baseURL:nil];

, , .

+3

webView , html. :

<body style='margin:0px;'><iframe ...></iframe></body>

.

, , : D iframe.

, !

0

All Articles