Hillegass Challenge P195

Discussion in 'Mac Programming' started by mdeh, Aug 13, 2009.

  1. mdeh macrumors 6502

    Jan 3, 2009
    The challenge is quite easy, I think...but there is one really puzzling aspect.

    The challenge reads
    {Emphasis is mine}

    The method used in AppController is this.

    -(IBAction) showPanel: (id) sender
    	BOOL successful = [NSBundle loadNibNamed: @"About" owner: self];
    	// More code here to check "successful"
    In the AboutWindow.xib I hooked up File's owner's aboutWindow outlet to the NSPanel Object (after setting File's owner to AppController). One other issue was to set the target of MainMenu's "About NewApplication" to AppController's method "showPanel".

    Now, this all works as expected. But...and this is the part I do not understand, if one comments out the outlet in Appcontroller AND severs the outlet in File's owner to the NSPanel Object, it **still** works, so I am left to ponder what role the IBOutlet plays in this setup?

    Thanks in advance.
  2. petron macrumors member

    May 22, 2009
    Malmo, Sweden
    Hi again Mdeh,
    It sounded strange and interesting at the same time so decided to test it myself.
    I just tested removal of the outlet in my software and the about panel do not want to be shown. I do have to have it in order to get it working.

    By the way when removing the outlet and saving the AppController.h file the Interface Builder lights a warning sign in the File's Owner connections. So it already knows that he lacks the outlet connection.

    best regards
  3. mdeh thread starter macrumors 6502

    Jan 3, 2009

    In the panel attributes (of IB) is "Visible At Launch" checked?
  4. petron macrumors member

    May 22, 2009
    Malmo, Sweden
    Hi Medh
    Yes, the "Visible at launch" option is checked out for "About" NSPanel


Share This Page