创建一个从 xml 文件中提取所有数据的滚动视图

发布于 2024-12-11 04:32:26 字数 1021 浏览 0 评论 0原文

我正在尝试创建一个“简单”的照片 ID 应用程序。最终产品将是滚动视图中的一系列图像,您可以单击它们以获取更多信息。图像和与图像相关的数据都以 XML 文件形式存储在网站上。

我可以创建一个应用程序,将 xml 加载到表视图中,并将 xml 项目标题作为单元格标签,然后当您单击该单元格时,将显示一个详细视图,其中包含有关该项目的其余详细信息。我可以将 xml 加载并解析到表视图中,没有太多问题。我似乎无法将此过程转换为滚动视图应用程序。我关注了 本教程,以及其他一些类似的教程,可以实现该结果。

我已经查看了苹果提供的 UIScrollView 示例以及几十个关于实现滚动视图主题的 YouTube 视频和博客教程,但是我还没有找到任何有关从 xml 中提取数据的文档。滚动视图也将进行分页,因此滚动视图中的页数需要从 xml 中包含的项目数动态加载(类似于 tableview 如何根据项目计数知道要创建多少行)。

我制作了一个滚动视图应用程序,一次加载 3 页并循环,如 本教程。 (中间有一个标记为“仅 3 页”的部分。)此应用程序以及 Apple 提供的页面控制示例定义了要显示的页面数,它们不从 plist 或 xml 数据中提取如何有很多项目并进行相应调整。

我不知道我现有的代码对任何人都有用,因为它与上面列出的相关教程几乎相同。如果有人想查看特定的内容,请告诉我,我会发布它。

谁能帮我弄清楚创建这个应用程序需要采取哪些步骤?如果我能让我的 xml 数据出现在滚动视图中(每个项目在其自己的页面上)并动态确定页数,我就可以调整它以包含图像,并担心使其“可点击” “ 之后。

I am trying to create a "simple" photo ID app. The final product would be a series of images in a scroll view that you can click on to get more information. The images and data pertaining to the images, are all stored on a website in an XML file.

I can create an app that loads the xml into a table view, with the xml item title as the cell label, then when you click on the cell, a detail view is shown with the remaining details about the item. I can load and parse the xml into the table view without much issue. I cannot, it seems, translate this process into a scroll view app. I followed this tutorial, and a few others like it, to achieve that result.

I have looked at the apple supplied examples of UIScrollView and several dozen YouTube videos and blog tutorials on the subject of implementing a scroll view, however I have yet to find any documentation on having the data pulled from xml. The scroll view is also going to be paging so the number of pages in the scroll view need to dynamically load from the number of items contained in the xml (similar to how the tableview knows how many rows to created based on item count).

I have made a scroll view app that loads 3 pages at a time and loops, like in this tutorial. (Half way down there is a section labeled 3 Pages Only.) This app, along with the Page Control sample that Apple provides, defines the number of pages that are to be displayed, they don't pull from the plist or xml data how many items there are and adjust accordingly.

I don't know that my existing code will be of any use to anyone as it's almost identical to the related tutorials listed above. If someone wants to see something specific, let me know and I'll post it.

Can anyone help me figure out what steps I need to take to create this app? If I can get my xml data to appear in the scroll view (each item on its own page) and have the number of pages determined dynamically, I'd be pretty set and can adjust it to include images and worry about making it "clickable" later.

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

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

发布评论

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

评论(1

一笑百媚生 2024-12-18 04:32:26

刚刚偶然发现了这个很棒的教程!不要寻找他的源代码并使用它,因为它不能正常工作。我必须稍微调整它才能在 iOS 5 中工作,但它确实有效。将其转换为 iPad 就像更改尺寸一样简单。如果有人对我如何完成这项工作有疑问,请告诉我。 此处发布的视频

Just stumbled on this awesome tutorial! Don't hunt for his source code and use that as it doesn't work properly. I had to tweak it a little bit to work in iOS 5, but it works. Converting it to iPad was as simple as changing the measurements. If anyone has questions about how I made this work, let me know. video posted here

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