开发者

pulling data from a website and storing it into an array - iPhone SDK

I am trying to write an app that searches a website, and takes all of the results and puts them into a customized table. I am an Objective-C and iPhone SDK noob, and am hoping that this logic is what I am trying to accomplish:

1) Searching multiple search engines and pulling all of the data off of each website, storing each into a different array (for example: Searching Google, Yahoo, and Bing for "Shoes", and taking all of the different search results, hyperlinks and all, and storing them into three different arrays)

2) Pulling the data out of each array, and putting into a table (Table view in Interface Builder)

I've also written some pseudo-code that I am hoping that you all can look over to see potential design flaws, and logic errors. I figure if we can get logic and design errors out of the way, throwing some syntax together could be relatively easy?

Class SearchWebsites:

NSString *websiteURL = "http://www.searchengine.com/keywords=";

UISearchBar SearchButtonClicked{
 NSString *websiteURL = websiteURL+searchBarText.text;
 Go to websiteURL;
 Extract all hyperlink data from websiteURL and store into NSArray *websiteData;
 Load SearchResults.xib;

}

End Class SearchWebsites



Class SearchResults:

Table data = NSArray *websiteData;

End Class SearchResults

I am assuming that I need to declare global variables, so that they can be called from different classes......right? What开发者_StackOverflow社区's the syntax for doing this? How do I set this up in IB? Did I bite off more than I can chew for this first app?

Thanks for your help!


i think this is really big question to be answered here :) ... First of all it might be useful for you to read the documentation from Apple about Objective-C http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html . Then you might search for UITableView programming guide on the developer website, but there is a nice tutorial here: http://icodeblog.com/2008/08/08/iphone-programming-tutorial-populating-uitableview-with-an-nsarray/

Moszi


You might want to use NSMutableDictionary to build a list of links - you can iterate it like an array if need be, but can also look up entries by name. iPhone SDK Development will teach you the basics you are after.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜