我应该将它存储在数组中,还是什么?

时间:2022-09-15 23:22:46

I am making an application (iPhone app) which gets information (jokes) from an RSS feed, then populates the tableView. Now, would I take the RSS and store it in an array then populate the tableView, or what?

我正在制作一个应用程序(iPhone应用程序),它从RSS源获取信息(笑话),然后填充tableView。现在,我是否会将RSS存储在一个数组中然后填充tableView,或者是什么?

And how do I receive information from an RSS feed?

我如何从RSS源接收信息?

Thanks!

3 个解决方案

#1


Store instances of NSDictionary in an NSArray. Populate the table's number of rows by returning the NSArray's count. Populate the table's rows by returning the NSArray's objectAtIndex for the specified row value.

将NSDictionary的实例存储在NSArray中。通过返回NSArray的计数来填充表的行数。通过返回指定行值的NSArray的objectAtIndex来填充表的行。

#2


Create a joke object and create an array full of the joke objects.

创建一个笑话对象并创建一个充满笑话对象的数组。

A simple example for pulling in rss feeds data is the seismic xml example on the apple developer samples site at: http://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html

一个拉入rss feed数据的简单示例是apple开发人员样本站点上的地震xml示例:http://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html

#3


You can use UITableViewDataSource to provide UITableView with data. You may want to have a look at lecture 8 of Stanford's CS193P which I believe explains how to use TableViews on iPhone (with code examples and explanation from Apple engineers).

您可以使用UITableViewDataSource为UITableView提供数据。您可能想看看斯坦福大学CS193P的第8讲,我相信它解释了如何在iPhone上使用TableViews(带有代码示例和Apple工程师的解释)。

If you poke around lecture notes you may find answer to your second question, how to get data over network - not RSS specific but you might get the idea (lecture 9? - not sure I'm not that far yet ...). Lectures are provided free over iTunesU and are of excellent quality explaining how to build iPhone apps.

如果你在讲解笔记,你可能会找到第二个问题的答案,如何通过网络获取数据 - 不是RSS特定的,但你可能会得到这个想法(讲座9? - 不确定我还没有那么远......)。讲座是通过iTunesU免费提供的,具有极高的质量,解释了如何构建iPhone应用程序。

#1


Store instances of NSDictionary in an NSArray. Populate the table's number of rows by returning the NSArray's count. Populate the table's rows by returning the NSArray's objectAtIndex for the specified row value.

将NSDictionary的实例存储在NSArray中。通过返回NSArray的计数来填充表的行数。通过返回指定行值的NSArray的objectAtIndex来填充表的行。

#2


Create a joke object and create an array full of the joke objects.

创建一个笑话对象并创建一个充满笑话对象的数组。

A simple example for pulling in rss feeds data is the seismic xml example on the apple developer samples site at: http://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html

一个拉入rss feed数据的简单示例是apple开发人员样本站点上的地震xml示例:http://developer.apple.com/iphone/library/samplecode/SeismicXML/index.html

#3


You can use UITableViewDataSource to provide UITableView with data. You may want to have a look at lecture 8 of Stanford's CS193P which I believe explains how to use TableViews on iPhone (with code examples and explanation from Apple engineers).

您可以使用UITableViewDataSource为UITableView提供数据。您可能想看看斯坦福大学CS193P的第8讲,我相信它解释了如何在iPhone上使用TableViews(带有代码示例和Apple工程师的解释)。

If you poke around lecture notes you may find answer to your second question, how to get data over network - not RSS specific but you might get the idea (lecture 9? - not sure I'm not that far yet ...). Lectures are provided free over iTunesU and are of excellent quality explaining how to build iPhone apps.

如果你在讲解笔记,你可能会找到第二个问题的答案,如何通过网络获取数据 - 不是RSS特定的,但你可能会得到这个想法(讲座9? - 不确定我还没有那么远......)。讲座是通过iTunesU免费提供的,具有极高的质量,解释了如何构建iPhone应用程序。