nstreecontroller

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

≯℡__Kan透↙ 提交于 2019-11-29 03:22:48
问题 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

NSOutlineView: remove disclosure triangle and indent

断了今生、忘了曾经 提交于 2019-11-28 15:50:31
问题 I'm using NSOutlineView for a project, and can't seem to figure out two things: How to remove the disclosure triangle for tree nodes. Apps like iTunes seem to be able to do this: Is there some sort of NSOutlineView Delegate method that is used for this? Or does it require a subclass? How to disable indenting for items. I've tried using setIndentationPerLevel: and setting it to 0, as well as changing the column indent to 0 in Interface Builder, but it does not seem to have any effect. 回答1: You

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

元气小坏坏 提交于 2019-11-28 00:14:39
问题 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? 回答1: 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