【问题标题】:Can I search youtube videos in iPhone app? [duplicate]我可以在 iPhone 应用中搜索 youtube 视频吗? [复制]
【发布时间】:2011-11-30 11:50:40
【问题描述】:

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

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

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

【问题讨论】:

标签: iphone search video youtube categories


【解决方案1】:

请务必查看如何在 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 中加载结果

【讨论】:

    猜你喜欢
    • 2011-07-01
    • 2012-04-10
    • 2012-01-11
    • 2016-02-23
    • 1970-01-01
    • 2016-09-02
    • 2012-08-02
    • 1970-01-01
    • 2015-07-12
    相关资源
    最近更新 更多