Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在iphone应用程序中嵌入youtube播放器_Iphone_Objective C_Ios_Ios4 - Fatal编程技术网

如何在iphone应用程序中嵌入youtube播放器

如何在iphone应用程序中嵌入youtube播放器,iphone,objective-c,ios,ios4,Iphone,Objective C,Ios,Ios4,我已经完成了前面的问题,并编写了简单的代码 - (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame { NSString *embedHTML = @"\ <html><head>\ <style type=\"text/css\">\ body {\ background-color: transparent;\ color: white;\

我已经完成了前面的问题,并编写了简单的代码

- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
    NSString *embedHTML = @"\
    <html><head>\
    <style type=\"text/css\">\
    body {\
    background-color: transparent;\
    color: white;\
    }\
    </style>\
    </head><body style=\"margin:0\">\
    <video src=\"point/to/mov\"></video>\
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
    width=\"%0.0f\" height=\"%0.0f\"></embed>\
    </body></html>";
    NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
    UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
    [videoView loadHTMLString:html baseURL:nil];
    //[videoView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=WL2l_Q1AR_Q"]]];
    [self.view addSubview:videoView];
    [videoView release];
}
-(void)embeddeYouTube:(NSString*)urlString frame:(CGRect)frame{
NSString*embedHTML=@”\
\
\
身体{\
背景色:透明\
颜色:白色\
}\
\
\
\
\
";
NSString*html=[NSString stringWithFormat:embedHTML,urlString,frame.size.width,frame.size.height];
UIWebView*videoView=[[UIWebView alloc]initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
//[videoView加载请求:[NSURLRequest requestWithURL:[NSURL URLWithString:@]http://www.youtube.com/watch?v=WL2l_Q1AR_Q"]]];
[self.view addSubview:videoView];
[视频视图发布];
}
如果使用“html”,它是否不显示。。。 但我们直接加载url,因为我评论说它工作正常

有人能帮我解决这个问题吗