Created
October 31, 2012 17:22
-
-
Save mretzak/3988459 to your computer and use it in GitHub Desktop.
YouTube embed in UIWebview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *embedHTML = @"\ | |
<html><head>\ | |
<meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 620\"/></head>\ | |
<script>document.ontouchmove = function(event) {event.preventDefault();}</script>\ | |
<body style=\"background:#000;margin:0px;\">\ | |
<div><iframe width=\"620\" height=\"348\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\" allowfullscreen></iframe>\ | |
</div></body></html>"; | |
NSString *html = [NSString stringWithFormat:embedHTML, url]; | |
UIWebView* webView = [[[UIWebView alloc] init] autorelease]; | |
[webView loadHTMLString:html baseURL:nil ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment