On Sat, May 24, 2008 at 1:21 AM, Johnny Lundy <[EMAIL PROTECTED]> wrote:
> I have used it to set my class as its delegate so that I could implement the > delegate method applicationWillTerminate:, and that was great. Easy to > understand, it calls respondsToSelector: and then calls my delegate method. > Cool. But as far as the "serves as a proxy for the object that owns the > nib", why does a nib need an owner? Why do I care who the owner is? My > NSArrayControllers can be bound to model objects without anything going > through File's Owner. They can indeed. You can use your nib-instantiated controller object's awakeFromNib method to set up your model objects, and wire your main menu's Open and Save items directly to methods in that controller. But if you ever want to use more than one controller, you'll probably have to start using methods like applicationDidFinishLaunching: (for synchronisation). That code path, as well as applicationWillTerminate:, goes through an object outside your nib (NSApplication), even though it's subsequently calling a delegate method inside your nib. Incidentally, have you ever written a document-based cocoa app? > Now if what they are trying to say is that I can bind a controller to File's > Owner and it will "see" all the properties of all the objects in the class > that File's Owner is set to, that would be cool. That is exactly what they are saying. > In that case it is just > serving as an instance of a class and can be used to reach properties of > objects of that class. Well, it's serving as a *proxy* for an *existing* instance of a class. Whereas instantiating an NSObject in the nib creates an instance and allows you to make connections to it, you can use File's Owner to make connections to an object that exists prior to loading of, and outside of, the nib. Hamish _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]