Re: Best practice for multiple NSWindowControllers on a document?
Re: Best practice for multiple NSWindowControllers on a document?
- Subject: Re: Best practice for multiple NSWindowControllers on a document?
- From: David Hoerl <email@hidden>
- Date: Wed, 24 Oct 2007 08:11:24 -0400
Well, I have this type of architecture, but my documents are immutable.
That said, it would appear to me that since you **know** all the
controllers, you could send each a message saying the document
changed, and let them deal with it, e.g. documentUpdated.
Since they are in an array you can use one of those
makeObjectsPerformSelector methods of NSArray to efficiently send
this to each window controller. (You can also roll your own
specialized versions of makeObjectsPerformSelector and add them as a
category - several examples of this on the web).
You could get more detailed with different messages conveying
different change notifications, ie
setDocumentTextUpdatedInRange:SomeRange, etc.
My suggestion is to avoid bindings and notifications, since the
target of the messages, that is the array of windowControllers, is
always known and in fact a property of your NSDocument subclass.
Just my $0.02.
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden