Re: how to set the NSApp delegate?
Re: how to set the NSApp delegate?
- Subject: Re: how to set the NSApp delegate?
- From: email@hidden
- Date: Mon, 13 May 2002 09:53:43 -0700
email@hidden wrote:
|What is not clear to me is when a instance of class B gets created and
|assigned as delegate.
|
|Is it done when the nib file is loaded? If so, what am I doing wrong,
|and how do I assign this instance to a variable?
You do it in Interface Builder, by instantiating your delegate class in the main nib file, then connecting the file owner's "delegate" connection to the delegate object.
|If I need to assign it programmatically myself, where do I do it,
|since main calls NSApplicationMain directly in the generated main.m
|file.
You'd make a subclass of NSApplication, tell PB that your subclass is the main class (in the target settings), then call "[self setDelegate: xxx]" in your initialization code.
However, if you're subclassing NSApplication, you probably don't need a delegate, too. The point of the delegate is so you don't have to subclass NSApplication.
Glen Fisher
_______________________________________________
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.