• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: File's Owner
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File's Owner


  • Subject: Re: File's Owner
  • From: Jacob Engstrand <email@hidden>
  • Date: Sat, 17 Aug 2002 01:52:38 +0200

Brian E. Howard asked:

Can someone point me to a definitive explanation of the "File's Owner"
Icon in IB and the use thereof?


The File's Owner is the object that loads the .nib file.

For the MainMenu.nib file in a standard Cocoa app, the File's Owner is the application object, since that is the object that loads MainMenu.nib at launch time.

When you load you own .nib file dynamically from your on code, like this:

BOOL didFine = [NSBundle loadNibNamed:@"MyExtraNibFile" owner:self];

then, the caller object (self) is the File's Owner.

Now, if you, for example, design a window with a NSTableView in your .nib file, and connect the datasource of that table to File's Owner, then load the .nib file with code like above, the NSTableView instance will call the object that loaded the .nib file when asking for number of rows, etc. (that owner is self in this case, but the argument owner: could be any object).

In short: It is a handy mechanism for setting up connections from objects in the .nib file to objects defined (and instantiated) elsewhere. So, you don't have to use it, but sometimes it is the only way set up communication between objects in the .nib and objects in defines elsewhere.

(You want to use this mechanism when writing a large app and you want to divide your windows etc between several .nib files (and perhaps load the only when/if they are needed).)

Hope this helps at all.

/jak

_________________________________________________________
In the depths of winter, I finally learned that within me
there lay an invincible summer. - Albert Camus
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Creating Menu Items from NSMutableArray
  • Next by Date: [newbie] takeValue:forKey memory management
  • Previous by thread: Re: File's Owner
  • Next by thread: adding pages to a generated pdf
  • Index(es):
    • Date
    • Thread