Twice recently I have found myself tinkering with NSDocument et al to support
observing of certain values.
For example, NSDocument -isDocumentEdited is not seemingly KVO compliant.
-isDocumentEdited status is driven by -updateChangeCount: so
in MYDocument : NSDocument the override is::
- (void)updateChangeCount:(NSDocumentChangeType)change
{
[self willChangeValueForKey:@"isDocumentEdited"];
[super updateChangeCount:change];
[self didChangeValueForKey:@"isDocumentEdited"];
}
Similarly for NSDocumentController and -recentDocumentURLs
in MYDocumentController : NSDocumentController the override is:
- (void)noteNewRecentDocumentURL:(NSURL *)aURL
{
[self willChangeValueForKey:@"recentDocumentURLs"];
[super noteNewRecentDocumentURL:aURL];
[self didChangeValueForKey:@"recentDocumentURLs"];
}
Is this the best way to go about addressing these sorts of issues with regard
to missing KVO compliance?
Jonathan
_______________________________________________
Cocoa-dev mailing list ([email protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]