大数据层次结构——如何实现?
我还在尝试开发一个小型的医疗iPhone应用程序。 :-] 在过去的几天里,我已经构建了应在表格中显示的所有数据。在阅读书籍和观看大量教程后,我构建了几个简单的表视图应用程序。这些应用程序始终具有预定义的数据深度。我不确定您是否明白我的意思,所以请打开以下链接来比较我的图形:
文件 hierarchie1.png 显示了我已在应用程序中使用的正常数据层次结构。我的数据的结构类似于文件 hierarchie2.png。
不幸的是我对 iPhone 开发经验不是很丰富。我的想法是为树的每个部分创建一个自己的视图控制器。
- EintragAViewController 管理1 - 2 - 3
- Eintrag1ViewController 管理1.1
- Eintrag11ViewController 管理 1.1.1 - 1.1.2 等等...
我希望你能明白我的意思。
我想知道的是我的想法是否是实现此类数据的正确方法?或者还有另一种更好的方法吗?
I am still trying to develop a small medicine iPhone app. :-] In the last few days I've structured all the data that should be displayed in a table. After reading books and watching a lot of tutorials I've built a couple of simple Table View applications. These apps always had a predefined depth of data. I am not sure if you understand what I mean by that, so please open the following links to compare my graphics:
You can find the graphics here!
File hierarchie1.png shows the normal data hierarchy I already used in my apps. My data is structered like in the file hierarchie2.png.
Unfortunately I am not very experienced with iPhone development. My idea is to create for every section of the tree an own view controller.
- EintragAViewController manages 1 - 2 - 3
- Eintrag1ViewController manages 1.1
- Eintrag11ViewController manages 1.1.1 - 1.1.2 and so on...
I hope you can get what I mean.
What I would like to know is if my idea is the right approach to realize that kind of data? Or is there another and better way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看
UINavigationController
和示例“基于导航的应用程序”,Xcode 作为模板项目提供。本质上,应用程序中的每个子节点 type(“Eintrag”类型)都将是
UIViewController
子类。对视图控制器的引用位于 UINavigationController 堆栈中。您可以推送和弹出引用以在视图层次结构中导航。
在每个视图控制器中,要打开另一个子节点,您可以在导航控制器上调用
-pushViewController:animated
方法,例如:您通常会在视图控制器的左上角有一个“后退按钮”应用程序窗口。这会触发“pop”,在编程上相当于:
Check out
UINavigationController
and the sample "Navigation-based application" that Xcode offers as a template project.Essentially, each child node type ("Eintrag" type) in your application will be a
UIViewController
subclass.References to view controllers are placed on the
UINavigationController
stack. You push and pop references to navigate through the view hierarchy.In each view controller, to open another child node, you call the
-pushViewController:animated
method on the navigation controller, e.g.:You'll usually have a "back button" in the top-left corner of the application window. This triggers a "pop", programmatically equivalent to:
如果对于每种树,任何级别的节点都属于相同类型,那么您的想法是有意义的 - 因此 EintragA 第 1 节中的表格单元格与 EintragA 第 2 节中使用的单元格类型相同。
当您推向更深的级别时,您可以创建相同类型的视图控制器的新实例,并只需告诉它们要显示的数据级别。
Your thought makes sense if for each kind of tree, the nodes at any level are all of the same type - so table cells in EintragA, section 1 are the same kinds of cells used in EintragA, section 2.
As you push to deeper levels, you can make new instances of the same types of view controllers and just tell them what level of data to display.