1

Ok so I'm finding this insanely difficult to find for something that is done a lot. I'm struggling to find a way of putting the newest YouTube videos from a user into a UITableView.

I've tried this but it's out of date and I gets heaps of errors: http://code.google.com/p/gdata-objectivec-client/downloads/detail?name=gdata-objectivec-client-1.11.0.zip

Aside from using a UIWebView, are there any good tutorials, that work, on putting YouTube videos in a UITableView?

4

2 回答 2

2

让我们举个例子.. 对于Netfel用户;点击他的播放列表;在链接栏中,您将看到“http://www.youtube.com/watch?v=4nx7g60Ldig&list=UUANsW00CkQnNnnUyuC1cygw”

现在..我们获取播放列表“数字”UUANsW00CkQnNnnUyuC1cygw 并且..我们将发出一个 JSON 请求..最多 50 个结果

http://gdata.youtube.com/feeds/api/playlists/UUANsW00CkQnNnnUyuC1cygw?v=2&alt=jsonc&max-results=50

您可以将 JSON 替换为 JSONC - 您将在结果中看到细微的变化;这将是您在应用开始时的请求

现在我们必须“解释/翻译”下一个结果:

{
apiVersion: "2.1",
data: {
id: "UUANsW00CkQnNnnUyuC1cygw",
author: "Nethfel",
title: "Uploaded videos",
description: "",
thumbnail: {
sqDefault: "http://i.ytimg.com/vi/4nx7g60Ldig/default.jpg",
hqDefault: "http://i.ytimg.com/vi/4nx7g60Ldig/hqdefault.jpg"
},
content: {
5: "http://www.youtube.com/p/UUANsW00CkQnNnnUyuC1cygw"
},
totalItems: 17,
startIndex: 1,
itemsPerPage: 50,
items: [
{
id: "UUGCa8nZNU7uOfDF3zV9AxkJtJSuX5gHGI",
position: 1,
author: "Nethfel",
video: {
id: "4nx7g60Ldig",
uploaded: "2011-11-02T12:32:03.000Z",
updated: "2013-01-07T18:26:41.000Z",
uploader: "nethfel",
category: "Howto",
title: "iOS Passing Data Between View Controllers Technique 1",
description: "This video discusses one of the most basic techniques for passing data between view controllers in an iOS application. This technique uses storing a local iVar in one class and passing it to the second class about to be displayed on the screen. Although this is a very simple example using an NSString, it can be applied using any other type of data as well - whether it be a collection or a custom data model object.",
thumbnail: {
sqDefault: "http://i.ytimg.com/vi/4nx7g60Ldig/default.jpg",
......

你拥有所有元素:标题、缩略图、页面链接等......你需要解析(提取)这个 JSON 响应......把它放在 TableView 中......

在单击单元格时,打开一个新的“详细信息”页面.. 是否可以拥有适用于 iOS 的 LBYouTubeView

于 2013-01-19T23:34:39.457 回答
1

如果您可以在 UIView 中播放 YouTube 视频,则可以将其嵌入 UITableView 控制器单元格中。

于 2013-01-18T21:14:04.387 回答