• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best practice for multiple NSWindowControllers on a document?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Disregard Binding to NSArrayController selection
  • Next by Date: Sending AppleEvent ansr
  • Previous by thread: Best practice for multiple NSWindowControllers on a document?
  • Next by thread: Endian safety of NSArchiver/NSUnarchiver
  • Index(es):
    • Date
    • Thread