Hillegass Challenge P195

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

  1. mdeh macrumors 6502

    Joined:
    Jan 3, 2009
    #1
    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.

    Code:
    -(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

    Joined:
    May 22, 2009
    Location:
    Malmo, Sweden
    #2
    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
    /petron
     
  3. mdeh thread starter macrumors 6502

    Joined:
    Jan 3, 2009
    #3

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

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

    /petron
     

Share This Page