I have an NSTreeController bound to an NSOutlineView (no core data). From Cocoa's reference:
add:
Adds an object to the receiver after the current selection.
- (void)add:(id)sender
What's tripping me out is that when the add method is invoked it places the new item at the end of the list, NOT after the selected item. The insert method seems to work as expected (item added before the selection). Am I doing something wrong? How does one insert a new node after the selected item and not at the end of the list?
What you probably want to do is call insertObject:atArrangedObjectIndexPath:.
Create an IBAction (i.e.: (IBAction)addAfterSelection:(id)sender) and have it instanciate your object, figure the selection's indexPath then call insertObject:atArrangedObjectIndexPath:.
If not that, perhaps verify ensure sorting happens on the NSOutlineView.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With