gpt4 book ai didi

iphone - LazyTableImages for iPhone 示例代码重新加载问题

转载 作者:行者123 更新时间:2023-12-03 20:00:22 25 4
gpt4 key购买 nike

我正在使用 LazyTableImages 示例代码从 RSS 源异步加载 TableView 中的图像。我想知道的是,一旦添加了新项目,如何在该表中重新加载(重新启动解析操作),具体到本示例?

http://developer.apple.com/library/ios/#samplecode/LazyTableImages/Introduction/Intro.html

非常感谢。

最佳答案

我认为您需要再次请求下载。您可能需要向 LazyTableAppDelegate 添加一个新方法来执行此操作,因为这是执行初始下载的类:

- (void)reloadAppList
{
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:TopPaidAppsFeed]];
self.appListFeedConnection = [[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self] autorelease];
}

此外,修改 -[LazyTableAppDelegate handleLoadedApps:] 以清除旧数据,如下所示:

- (void)handleLoadedApps:(NSArray *)loadedApps
{
[self.appRecords removeAllObjects];
rootViewController.entries = [NSArray array];
[self.appRecords addObjectsFromArray:loadedApps];

// tell our table view to reload its data, now that parsing has completed
[rootViewController.tableView reloadData];
}

我自己没有尝试过,但这是基本想法。

关于iphone - LazyTableImages for iPhone 示例代码重新加载问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4220697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com