2011-06-01 18 views
1

我使用這個代碼,看YouTube視頻可以使用此代碼在模擬器上檢查YouTube視頻嗎?

- (YouTubeView *)initWithStringAsURL:(NSString *)urlString frame:(CGRect)frame; 
{ 
if (self = [super init]) 
{ 
    // Create webview with requested frame size 
    self = [[UIWebView alloc] initWithFrame:frame]; 

    // HTML to embed YouTube video 
    NSString *youTubeVideoHTML = @"<html><head>\ 
    <body style=\"margin:0\">\ 
    <embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \ 
    width=\"%0.0f\" height=\"%0.0f\"></embed>\ 
    </body></html>"; 

    // Populate HTML with the URL and requested frame size 
    NSString *html = [NSString stringWithFormat:youTubeVideoHTML, urlString, frame.size.width, frame.size.height]; 

    // Load the html into the webview 
    [self loadHTMLString:html baseURL:nil]; 
} 
return self; 

}

現在我無法看到的simulator..however白色的WebView相對視頻快到那裏..

那麼是否有類似的情況,我無法在模擬器上看到youtube視頻,或者代碼中是否存在其他問題?

回答

1

在模擬器中無法看到Youtube視頻。如果顯示白色webview,我認爲你的代碼有效。

嘗試在iPhone/iPod touch上安裝。

+0

是白色的webview在那裏:) – 2011-06-01 09:04:26

+0

done ... thankuuu – 2011-06-01 15:29:33

相關問題