Joe Shimkus
2004-11-14 21:07:05 UTC
So I've got a subclass of NSDocument and it receives a
-revertDocumentToSaved: message and loads from the saved file; no
problem. The question is, in trying to maintain a pure MVC organization
how do I inform the controller that the document has changed so it can
update the view since there are attributes that apply to the document
but not to the application as a whole? I think I might be able to do it
with KVC/KVO but I haven't studied that enough to put it into practice
and what was done before KVC/KVO?
Right now I've overridden -revertToSavedFromFile:ofType: in my document
to invoke its super's version and, if the the above returns YES, to
execute the following:
[[self windowControllers]
makeObjectsPerformSelector:@selector(documentReverted)];
which isn't too terrible but does require that the document presuppose
the existence of 'documentReverted' in its window controllers. I can't
locate a notification or delegate method that would inform the
controller.
Any suggestions?
-revertDocumentToSaved: message and loads from the saved file; no
problem. The question is, in trying to maintain a pure MVC organization
how do I inform the controller that the document has changed so it can
update the view since there are attributes that apply to the document
but not to the application as a whole? I think I might be able to do it
with KVC/KVO but I haven't studied that enough to put it into practice
and what was done before KVC/KVO?
Right now I've overridden -revertToSavedFromFile:ofType: in my document
to invoke its super's version and, if the the above returns YES, to
execute the following:
[[self windowControllers]
makeObjectsPerformSelector:@selector(documentReverted)];
which isn't too terrible but does require that the document presuppose
the existence of 'documentReverted' in its window controllers. I can't
locate a notification or delegate method that would inform the
controller.
Any suggestions?
--
PGP Key (DH/DSS): http://www.shimkus.com/public_key.asc
PGP Fingerprint: 89B4 52DA CF10 EE03 02AD 9134 21C6 2A68 CE52 EE1A
Windows has always aspired to be Mac-like without Microsoft ever really
understanding what that even means. - Robert Cringely
PGP Key (DH/DSS): http://www.shimkus.com/public_key.asc
PGP Fingerprint: 89B4 52DA CF10 EE03 02AD 9134 21C6 2A68 CE52 EE1A
Windows has always aspired to be Mac-like without Microsoft ever really
understanding what that even means. - Robert Cringely