我可以在iPhone应用中搜索youtube视频吗?

时间:2011-11-30 11:50:41

标签: iphone search video youtube categories

  

可能重复:
  How can I do a search for video on youtube in my iPhone app?

我正在编写一个iPhone应用程序,可以从youtube中搜索带有类别(标签)的视频并播放它们。 我可以使用网址在应用中播放YouTube视频,但我想知道如何在YouTube上搜索视频,并在我的iphone应用中获取视频网址。

是否有任何示例代码或教程可以做到这一点?

1 个答案:

答案 0 :(得分:0)

请务必查看如何在webView中开始执行此操作:

- (void)viewDidLoad {

    NSString *urlAddress = @"http://youtube.video.link.there";

    //Create a URL object.
    NSURL *url = [NSURL URLWithString:urlAddress];

    //URL Requst Object
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

    //Load the request in the UIWebView.
    [youtubeWebView loadRequest:requestObj];

    //This is for stop bounce of the webView if you want
    [[[youtubeWebView subviews] lastObject] setAlwaysBounceVertical:NO];

}

您可以在youtube中创建一个小型浏览器网页,并将结果加载到webView中,或者如果您喜欢在另一个xib中的webView中加载