Search code examples
objective-ccocoamethodscall

execute objective-c method on document load


Pretty confused newbie here:

I have a class, this class is adding columns to a table. In a first step this was done by hitting a button. I've added a generic object to the interface builder, assigned the class that adds the column to the table and made the connections; this way when I hit the button the columns are added. Now I need to modify this program and run the method whenever a document is loaded (document based application), so I need to call my method from inside the - (void)windowControllerDidLoadNib:(NSWindowController *)aController method. Now what confuses me is: how can I call a method of an object that is connected to the interface builder?

--- EDIT ---

If you feel you have to downvote, please at least say why! since I am a newbie what may sound like a stupid question for you is a pretty advanced question for me.

--- EDIT 2 ---

Probelm found, check my own answer.


Solution

  • I found what the problem is: my class adds column to the table by reading out informations from a NSarraycontroller. this NSArraycontroller is populated by the coreframework. but it is populated only AFTER the view is loaded so i cannot fill the tables at startup without using a timer or something like that!