Re: [NSApp setDelegate]
Re: [NSApp setDelegate]
- Subject: Re: [NSApp setDelegate]
- From: Eric Peyton <email@hidden>
- Date: Tue, 5 Jun 2001 14:53:31 -0500
I believe that both of the references apps you describe have their
NSApp delegates set in the .nib file.
In your Main nib file, you have a File's Owner that is a
NSApplication. Drag from that object (the very first object) to
your controller object in the nib and set the delegate there.
Eric
On Tuesday, June 5, 2001, at 12:55 PM, email@hidden wrote:
Please forgive me if this question is exceedingly stupid.
I'm trying very hard to work my head around creating a delegate
for my application, but am having some trouble. I know what
delegates do, and I know why I need them. What I don't know is
how to instantiate them. NSApplication has a method [NSApp
setDelegate] which (I would assume) would be called either in the
NSApplication's init: method, or from another already instantiated
class. Looking through Apple's supplied examples (Sketch and
TextEdit), I don't see this method being called, even though each
app has a delegate. While looking at the source for the apps, I
notice that neither delegate is called from code or has a custom
init: method. With out calling [NSApp setDelegate] how does an app
know which class should implement the delegate method? Does NSApp
send a [myClass respondsTo:] method to all instantiated classes?
Is there a setting in IB or PB that I am missing?
--Robert Lee Dotson
"The illegal we do immediately. The unconstitutional takes a
little bit longer."
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev