On Jan 9, 3:42 pm, Florian Zschocke wrote:
> Something wrong with IB?
Probably not. What you are reporting is almost certainly a frequently-
encountered trap in naming properties and IBOutlets.
> The first ting funny is that my action method is called from the
> [NSNibOutletConnector establishConnection] before awakeFromNib.
Suppose you have declared you button outlet thus:
IBOutlet NSButton * aProperty;
Is the button's action method
- (IBAction) setAProperty: (id) sender;
?
Refer to the documentation for -awakeFromNib :
> For each outlet that needs a connection, the NSNib object looks for
> a method of the form setOutletName: in your object. If that method
> exists, the NSNib object calls it, passing the target object as a
> parameter. If you did not define a setter method with that exact
> name, the NSNib object searches the object for an instance variable
> (of type IBOutlet id) with the corresponding outlet name and tries
> to set its value directly.
So when you NIB is loaded, and it comes time to connect your button to
the outlet, the NIB loader finds your setAProperty: method, and calls
it, rather than set the aProperty instance variable directly.
-- F
>> Stay informed about: What is [NSNibOutletConnector establishConnection]?