I know this is an easy one, but I just thought I could spare myself some (more) time searching through the documentation.
Usually, when I have an "Add" and a "Remove" button, along with an NSArrayController
, I simply have to click-drag from each button and connect them to the add:
and remove:
actions of the NSArrayController
.
Now, I'm trying to do the very same thing, programmatically with NSArrayController
(co
) :
[addButton setAction:@selector(add:)];
[addButton setTarget:co];
What am I doing wrong?
The rest of the NSArrayController
operations, handling an NSMutableArray
of dictionaries, etc works fine.
My psychic debugger* tells me that you're probably doing this in an init
method, where neither of the outlets, to the array controller or the button, are connected yet.
Put this into awakeFromNib
or a method which you know is called after the xib is loaded.
*psydb
, of course.