基于文档的应用程序,还是不?
我正在 Cocoa 中构建啤酒配方应用程序。它有一个主窗口,带有几个文本字段、表格视图等。我希望能够以 XML 格式打开和保存食谱。我找到了一些读/写 XML 的例子。我的申请应该是基于文档的申请吗?有什么好处?我发现的基于文档的应用程序的所有示例都使用 RTF 文件或二进制(绘图)文件,而不是 XML。
I am building a beer recipe application in Cocoa. It's has one main window, with a couple of textfields, tableviews etc. I want to be able to Open and Save recipes in XML format. I found some examples of reading/writing XML. Should my application be a document-based application? What are the benefits? All examples I find of document-based applications are using RTF files or binary (drawings) files, never XML.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于文档的应用程序使用的文件格式根本不重要。如果您愿意,您可以读取和写入 XML。
NSDocument 的优点是可以为您处理打开、保存、另存为和关闭按钮,以及“退出前保存”消息和各种其他操作。
我可以想到食谱应用程序的两种解决方案:
我认为对于啤酒配方应用程序,第二种解决方案将提供更好的用户体验,因为用户不太可能同时编辑两个配方(请参阅 美味汤! 例如)。
我希望这能回答你的问题。 :)
The file format used with document based applications doesn't matter at all. You can read and write XML if you like.
The advantages of
NSDocument
are that open, save, save as and the close button are handled for you, as well as a "Save before quit"-message and various other things.I can think of two solutions for a recipe application:
I think for a beer recipe app, the second solution would give a better user experience because a user is unlikely to edit two recipes at the same time (see YummySoup! for example).
I hope this answers your question. :)