nstreecontroller

Is there no way to use IB and the relationship of two entities to populate an OutlineView?

。_饼干妹妹 提交于 2020-01-16 18:30:13
问题 I have touched on this question in others before but after writing an answer to a previous question there got me wondering why this isn't possible - or am I missing the fact that it might be? Given that Interface Builder is very good at graphically linking various methods and delegates and data sources, is it possible that there's no straightforward graphical means to populate an OutlineView using two entities made in a Core Data model that have a parent child relationship set up so that (I

Is there no way to use IB and the relationship of two entities to populate an OutlineView?

坚强是说给别人听的谎言 提交于 2020-01-16 18:30:10
问题 I have touched on this question in others before but after writing an answer to a previous question there got me wondering why this isn't possible - or am I missing the fact that it might be? Given that Interface Builder is very good at graphically linking various methods and delegates and data sources, is it possible that there's no straightforward graphical means to populate an OutlineView using two entities made in a Core Data model that have a parent child relationship set up so that (I

Is it possible to bind an NSTreeController to an NSOutlineViewDataSource?

試著忘記壹切 提交于 2019-12-13 04:09:22
问题 I have some hierarchical data model that I'd like to present in an NSOutlineView. I'm binding a tree controller to the outline view to provide data and to handle selection and binding to other views. However, I only want to show only part of the data in my model to the outline view. (Each object in my hierarchy has an array of child objects, but I'd only like some of these child objects to appear as child nodes of the node in the tree.) I wish I could just attach a filter predicate to the

NSOutlineView and NSTreeController example

醉酒当歌 提交于 2019-12-12 07:46:22
问题 Please send me some links on how to use NSOutlineView with NSTreeController bindings without using core data. 回答1: In addition to the documentation, Apple's sample SourceView project should help you better understand things: "SourceView" is a Cocoa application that demonstrates how to use NSOutlineView driven by NSTreeController and various other Cocoa classes to produce a Finder-like left column source view. Among the key features used to imitate this commonly used view are the use of

How to create SourceList to show Core Data ToMany relations?

两盒软妹~` 提交于 2019-12-11 10:26:42
问题 Coming from iOS, I am stuck at NSOutlineView as Source list, I have read many resources but cannot grasp it clearly. What I want is, just to show coreData ToMany relationship as sourceList using NSTreeController. I am persisting data from text file to disk. Entities and relations are as follow: Group >> Item >> Description SourceList Example: My app do not allow user to create any new Entity, just to view what saved from TextFile. I can do this by NSArrayController but I need to show data in

“Ambiguous use of 'children'” when trying to use NSTreeController.arrangedObjects in Swift 3.0

南楼画角 提交于 2019-12-02 01:30:41
问题 I get an Ambiguous use of 'children' error in XCode 8.0/Swift 3.0 when trying to send a message to the opaque NSTreeController.arrangedObjects object. Here is a bare playground showing the use case : import AppKit extension NSTreeController { func whatever () { let k = (self.arrangedObjects as AnyObject).children // error here } } I try to use AnyObject as a bridge to the underlying ObjC object, which is supposed to be able to get through any method call, I guess. Xcode signals that it found

“Ambiguous use of 'children'” when trying to use NSTreeController.arrangedObjects in Swift 3.0

家住魔仙堡 提交于 2019-12-01 22:10:56
I get an Ambiguous use of 'children' error in XCode 8.0/Swift 3.0 when trying to send a message to the opaque NSTreeController.arrangedObjects object. Here is a bare playground showing the use case : import AppKit extension NSTreeController { func whatever () { let k = (self.arrangedObjects as AnyObject).children // error here } } I try to use AnyObject as a bridge to the underlying ObjC object, which is supposed to be able to get through any method call, I guess. Xcode signals that it found two candidates that could respond to a "children" message: Foundation.XMLNode and AppKit.NSTreeNode .

Correct way to get rearrangeObjects sent to an NSTreeController after changes to nodes in the tree?

China☆狼群 提交于 2019-12-01 09:56:20
问题 What is the appropriate way to get rearrangeObjects to be sent to an NSTreeController after changes to nodes in the tree? I have a sample application (full code below) using an NSOutlineView and NSTreeController with a simple tree of Node objects. In Version1 of the app, when you edit the name of a Node, the tree doesn't get resorted until you click the column header or use the “Rearrange” item in the menu. The latter is set up to directly send rearrangeObjects to the NSTreeController. In

How to bind NSTreeController's Children to Core Data ordered to-many-relationship?

荒凉一梦 提交于 2019-11-30 05:30:14
Apple introduced ordered to-many-relationships in Core Data in Lion. I created an entity named TreeNode with an 1:1-object-relation, a 1:1-parent-relation and an ordered to-many-relationship children. Then I have an NSTreeController with the children key path set to TreeNode.children. Running the application only shows first level elements. So children is not working. Since children is an ordered to-many-relationship, the corresponding class has an NSOrderedSet children. I added a custom method - (NSArray *) childrenArray { return [children array]; } to TreeNode which works. I could not find

Given model object, how to find index path in NSTreeController?

旧巷老猫 提交于 2019-11-29 06:55:35
Given model objects that NSTreeController represents, how do you find their index paths in the tree and subsequently select them? This seems to be a blindingly obvious problem, but I can't seem to find any reference to it. Any ideas? Rob Keniger There's no "easy" way, you have to walk the tree nodes and find a matching index path, something like: Objective-C: Category @implementation NSTreeController (Additions) - (NSIndexPath*)indexPathOfObject:(id)anObject { return [self indexPathOfObject:anObject inNodes:[[self arrangedObjects] childNodes]]; } - (NSIndexPath*)indexPathOfObject:(id)anObject