全局变量、数组和搜索结果

发布于 2024-10-09 15:14:53 字数 373 浏览 0 评论 0原文

我正在尝试编写一个应用程序来搜索网站,并获取所有结果并将它们放入自定义表格中。我是 Objective-C 和 iPhone SDK 菜鸟,希望这个逻辑就是我想要实现的目标:

1)搜索多个搜索引擎并从每个网站中提取所有数据,将每个数据存储到不同的数组中(例如示例:在 Google、Yahoo 和 Bing 中搜索“鞋子”,并获取所有不同的搜索结果、超链接等,并将它们存储到三个不同的数组中)

2)从每个数组中提取数据,然后放入表中(Interface Builder 中的表视图)

我假设我需要声明全局变量,以便可以从不同的类调用它们......对吗? 执行此操作的语法是什么? 我如何在 IB 中进行设置? 对于第一个应用程序,我是否贪得无厌?

感谢您的帮助!

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 am assuming that I need to declare global variables, so that they can be called from different classes......right?
What'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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

∞梦里开花 2024-10-16 15:14:53

亚伦,我还认为你在一个问题上咬牙切齿,但让我给你指出一个我在关于如何构建程序的类似主题上编写的资源

作为 Obj-C 菜鸟,您需要格外小心地记住模型-视图-控制器模式。从网站提取数据是一项艰巨的工作 - 并且您希望将其与显示和控制代码分开。

拥有一个干净的 API 模型来提取和排序数据,并拥有一个清晰的视图控制器类来从 API 读取数据。

我的建议是首先用伪代码编写整个应用程序,然后在我们身上尝试一下您的想法。

Aaron, I also think you're biting off more than you can chew WRT a single question on SO, but let me point you to a resource I wrote on a similar topic about how to structure your program.

As an Obj-C noob, you're going to need to take extra care to remember the Model-View-Controller pattern. Extracting data from a web site is a bit of work - and you want to keep that very separate from your display and control code.

Have a clean API model that extracts and sorts data, and have a clear view controller class that reads data from the API.

My advice is to write the whole app in psuedo-code first and try out your thinking on us.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文