gData YouTube 提要
我已经构建了一个应用程序来加载 youtube feed 并将其显示在 UITableView 中。
我还添加了单击表格末尾出现的“加载更多”单元格的功能,该单元格旨在使用提要 nextLink 并加载另外 10 个视频,这些视频应填充表格末尾。
然而问题是,表格被新的 10 项完全替换,而不是添加到已经显示的内容中。
我使用的代码如下:
NSLog(@"%@", [[feed nextLink] href]);
NSURL *feedURL;
feedURL = [NSURL URLWithString: [[feed nextLink] href]];
GDataServiceGoogleYouTube *service = [self youTubeService];
ticket = [service fetchFeedWithURL:feedURL delegate:self
didFinishSelector:@selector(request:finishedWithFeed:error:)];
以及以下方法:
- (void)request:(GDataServiceTicket *)ticket
finishedWithFeed:(GDataFeedBase *)aFeed
error:(NSError *)error {
self.feed = (GDataFeedYouTubeVideo *)aFeed;
[superTable reloadData];
}
有谁知道更好的方法,或者我是否可以将现有提要的内容与我获取的新提要的内容结合起来?即...如果应用程序加载时获取视频 1 - 10,我是否需要重新获取 1-20 或者我可以简单地获取 11-20 并将它们添加到表数据源中吗?
干杯
I have built an applicaiton to load in a youtube feed and display it in a UITableView.
I have also added the ability to click a "Load More" cell which appears at the end of the Table which is meant to use the feeds nextLink and load 10 more videos which should populate the end of the table.
The problem is however, the table gets completely replaced with the new 10 items, instead of adding to what is already being displayed.
The code I am using is as follows:
NSLog(@"%@", [[feed nextLink] href]);
NSURL *feedURL;
feedURL = [NSURL URLWithString: [[feed nextLink] href]];
GDataServiceGoogleYouTube *service = [self youTubeService];
ticket = [service fetchFeedWithURL:feedURL delegate:self
didFinishSelector:@selector(request:finishedWithFeed:error:)];
And the below method:
- (void)request:(GDataServiceTicket *)ticket
finishedWithFeed:(GDataFeedBase *)aFeed
error:(NSError *)error {
self.feed = (GDataFeedYouTubeVideo *)aFeed;
[superTable reloadData];
}
Does anyone know of a better way or if I can combine the contents of an existing feed with the new one I fetch? ie....If when the application loads it gets videos 1 - 10, do I need to refetch 1-20 or can I simply get 11-20 and add them to the tables datasource?
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将一个提要的条目移动到另一个提要,只要您删除其指向原始提要的父指针,就像
如果您通过索引从服务器检索条目,则不能保证第二个提要中的条目不在其中如果 feed 顺序在两次获取之间发生了变化,则为第一个 feed。
如果提要不是很大,您可以通过在服务对象上调用 setServiceShouldFollowNextLinks: 来一次获取其所有页面。
You can move the entries of one feed to another, so long as you remove their parent pointer to their original feed like
If you are retrieving entries from the server by index, there is no guarantee that the entries in the second feed were not also in the first feed if the feed order has changed between fetches.
If the feed is not huge, you can fetch all pages of it at once by calling setServiceShouldFollowNextLinks: on the service object.