Re: [NSApp setDelegate]
Re: [NSApp setDelegate]
- Subject: Re: [NSApp setDelegate]
- From: Andreas Monitzer <email@hidden>
- Date: Tue, 5 Jun 2001 21:55:11 +0200
On Tuesday, June 5, 2001, at 07:55 , email@hidden wrote:
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?
Yes, you can define a delegate in IB by connecting the class to the main
Nib's owner (which is the main NSApplication instance).
andy
--
Discussion forthcoming.