Re: NSWindowDidBecomeMainNotification firing twice?
Re: NSWindowDidBecomeMainNotification firing twice?
- Subject: Re: NSWindowDidBecomeMainNotification firing twice?
- From: Allan Odgaard <email@hidden>
- Date: Sun, 7 Mar 2004 22:39:33 +0100
On 7. Mar 2004, at 22:14, James McConnell wrote:
This is the code I have in - (void)awakeFromNib: in MyDocument
Each new document will cause the Nib to be loaded (to create a new
instance), so you'll add a new notification each time.
Where should I put the code for the notification? I originally had it
in init:, and it did the same thing, firing a notification for each
window instance, not just the active one. What am I missing here?
Each document (and thus window) will have its own instance of the
MyDocument-class. So this is not the class which should handle the
notificaiton.
I think you should introduce a new class, e.g. an application delegate,
a document controller subclass or similar (i.e. one which will only be
instantiated once), and let this class handle the notification.
_______________________________________________
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.