Re: File's Owner
Re: File's Owner
- Subject: Re: File's Owner
- From: Pierre-Olivier Latour <email@hidden>
- Date: Sat, 17 Aug 2002 03:42:35 +0200
>
Can someone point me to a definitive explanation of the "File's Owner"
>
Icon in IB and the use thereof? I have looked in my three Cocoa books,
>
googled, and checked the archives, but I still do not have a handle on
>
this.
When you programmatically load a NIB file, you need to specify its "owner"
by passing an object instance. This object you pass then replaces the
"virtual" object present in the NIB's file and defined as "File's Owner".
When building your interface, you can use this virtual object as any other
object instance created explicitly in Interface Builder.
When your app loads, NSApplication is responsible for loading its NIB file,
and as a consequence, sets its owner to NSApp (the global unique instance of
NSApplication).
If you load NIB files yourself (for example to share common interfaces
between multiple applications, load plug-ins that have an interface), you
can define the owner to be whatever object you want. If you're building an
About panel replacement class for all your apps, you can set the owner of
the related NIB file to your application's controller object.
I see this as a very practical method for connecting elements of your NIB
files to an object that does not exists in the NIB file and make your NIB
files independent from the application that uses it.
_____________________________________________________________
Pierre-Olivier Latour email@hidden
Lausanne, Switzerland
http://www.pol-online.net
_______________________________________________
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.
References: | |
| >File's Owner (From: "Brian E. Howard" <email@hidden>) |