سؤال

Basically, in my application's initialization, I want to set the value of a control's property once it has been loaded. In MonoMac, it appears that when the MainWindowController's Initialize method is called, the control outlets are not necessarily available (they are null).

I couldn't find any events such as LoadComplete that I could listen on and then do the required initialization on my control.

هل كانت مفيدة؟

المحلول

You should use the AwakeFromNib method in your MainWindowController class. It is called once all the objects have been loaded and connected.

public override void AwakeFromNib ()
{
    base.AwakeFromNib ();

    // Do something here with the outlets
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top