是否有一个标准的、有记录的开发模式来创建类似于 iTunes、iCal、iPhoto 等的 UI 布局?
我是 Cocoa 开发的新手,我正在尝试使用我认为是 iTunes、iCal、iPhoto、Billings、1Password、Numbers、Delicious Library 等应用程序共享的“标准”布局来创建 UI 布局。这种典型的布局可以描述如下:
- 屏幕左侧的“库”面板,通常用于发现层次结构。该面板通常覆盖大约四分之一的水平空间。
- “库”面板右侧的“主”面板,大多数 UI 交互都在该面板上进行。这占用了剩余的水平空间,我们可以在其中找到 iCal 中的每月日历视图或 iTunes 中的专辑封面和播放列表图块等内容。
- 屏幕左下角的一些“实用程序”面板,通常用于其他选项等。
是否有记录的模式可以显示有关如何为这些类型的布局“连接”视图和控制器类的最佳实践?例如,要使用多少个 ViewController、使用基于 NSDocument 的方法是否有意义、一些常见的陷阱等等?这种布局如此普遍,令我惊讶的是似乎没有任何好的参考资料。
更新: 我忘了提到我可以访问 Apple Developer 站点,虽然我可以找到 Cocoa 中不同类的库参考,但我似乎找不到关于如何将它们整合到我描述的布局中的良好参考。
像 Aaron Hillegass 和其他人这样的书非常适合学习 Cocoa 的基础知识和创建简单的界面(在连接到 NSDocument 的视图上布置一些控件),但在指导您了解我所描述的 UI 布局方面却不太好。
谢谢。
I am new to Cocoa development and I am trying to create UI layouts using what I consider to be the "standard" layout that is shared by apps like iTunes, iCal, iPhoto, Billings, 1Password, Numbers, Delicious Library, etcetera. This typical layout can be described as follows:
- A "Library" panel on the left side of the screen, usually meant for discovering hierarchies. This panel usually covers about a fourth of the horizontal space.
- A "Main" panel to the right of the Library panel on which most of the UI interactions take place. This takes the remaining horizontal space and is where we find things like the monthly calendar view in iCal, or the tile of album art and playlists in iTunes.
- Some "Utility" panel on the bottom-left corner of the screen, usually for things like additional options.
Is there a documented pattern that will show best practices on how to "wire" the View and Controller classes for these types of layouts? For instances, how many ViewControllers to use, whether or not using an NSDocument-based approach makes sense, some common pitfalls, etcetera? This layout is so prevalent, that I am surprised that there doesn't seem to be any good reference on it.
Update:
I forgot to mention that I have access to the Apple Developer site, and while I can find the library reference for the different classes in Cocoa, I cannot seem to find a good reference for how to bring it all together in the layout I describe.
Books like Aaron Hillegass' and others out there are great to learn the basics on Cocoa and creating simple interfaces (a few controls laid out on an view connected to an NSDocument), but not so great at guiding you to the UI layout I describe.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
左侧的分层视图称为源视图,您通常可以使用
NSOutlineView
类创建它。查看 Apple 的 SourceView 示例代码。它实现的源视图与 Finder 和其他地方的源视图非常相似,应该会给您一个良好的开端。
The hierarchical view on the left is called a Source View and you would normally create this with the
NSOutlineView
class.Have a look at Apple's SourceView sample code. It implements a source view very similar to the one in the Finder and elsewhere and should give you a big head start.
你提到的应用范围非常广泛,无法给出直接答案。
一般来说,您称为库的项目通常是 NSOutlineView(用于层次结构)或 NSTableView。
主面板实际上取决于其中包含的操作,实用程序面板也是如此。
我的建议是阅读 Apple 的 OS X 人机界面指南。这将为您提供有关如何做事的最佳概述。除此之外,实际的实现过于依赖于各个程序。
The range of applications you mentioned is so wide that it is impossible to give a direct answer.
In general, the item you call a Library is usually an NSOutlineView (for hierarchies) or an NSTableView.
The main panel really depends on the actions contained within, same for the utility panel.
My suggestion is to read Apple's Human Interface Guidelines for OS X. This will give you the best overview of how to do things. Other than that, the actual implementations are too dependent on the individual program.