December 29, 2005

How does one Set the delegate value for an NSOutlineView in Interface Builder in Xcode 2

Sometimes these implicit interfaces are just too obtuse. I wasted a DAY figuring this out.

I needed to mark my class (SakaiDesktop) as a delegate for a NSOutlineView control on my window. I knew that it had something to do with dragging. The last step is what is missing.

Place Mouse over the Outline Control on the Window

Control-Drag from the Window to the instance of SakaiDesktop and release

The Inspector will switch to Outlets (this is what kept confusing me)

Switch *back* to Actions in the Inspector - delegate and datasource will be there - click on the row for delegate and the instance willbe the designated delegate.

Funny how this did not work:

[myOutline setDelegate:self];


When I did it in init.

The problem I had was without being set to the delegate, the

- (void)outlineViewSelectionDidChange:(NSNotification *)notification

Notifications were not being delivered.

If the people who built NIB builder just made it so that picking a delegate used a drop down list instead of this multi-click gymnastics, I would be much happier.

Posted by csev at December 29, 2005 03:26 PM