NSTreeController setcontent 可以与 NSXMLDocument 一起使用吗?
我正在尝试在大纲视图中显示简单的 plist (xml) 文件的内容。
一旦我在 NSXMLDocument 或 NSDictionary 中拥有文件数据,是否可以仅使用此现有结构来填充 TreeController?我能找到的所有代码示例都会解析并重建所有节点和内容。这不是已经在 NSXMLDocument 中建立了吗?
谢谢罗布
I'm trying to display the content of a simple plist (xml) file in an outlineview.
Once I have the file data in either an NSXMLDocument or an NSDictionary, is it possible to just use this existing structure to populate the TreeController? All the code examples I can find parse through and reconstruct all the nodes and contents. Isn't this already established in the NSXMLDocument?
thanks
rob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
绑定使这变得非常容易。
如果您使用标准绑定,您可以将 NSTreeController 与 NSOutlineView 结合使用,并且只需很少的代码。
要使示例应用程序中的 NSXML 对象与 NSTreeController 对象一起工作,您只需通过类别向 NSXMLNode 类添加几个方法即可。
https://developer.apple.com /library/mac/#documentation/Cocoa/Conceptual/NSXML_Concepts/Articles/UsingTreeControllers.html
这里是屏幕截图NSTreeContoller 的相关设置
和 NSOutlineView 的 TableColumn
Bindings make this really easy.
You can use a NSTreeController combined with an NSOutlineView and very little code if you use standard bindings.
To make the NSXML objects in the sample application work together with the NSTreeController object, you simply have to add a couple methods to the NSXMLNode class through a category.
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/NSXML_Concepts/Articles/UsingTreeControllers.html
here are screenshots of the relevant settings for both the NSTreeContoller
and NSOutlineView's TableColumn