Re: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
Re: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
- Subject: Re: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
- From: Chris Hanson <email@hidden>
- Date: Wed, 07 Sep 2011 19:50:51 -0700
On Sep 7, 2011, at 5:58 PM, vade wrote:
> I have an NSWindow, which my app controller is observing the value of @"visible" keypath, with the following line
>
> [previewWindow addObserver:self forKeyPath:@"visible" options:NSKeyValueObservingOptionNew context:NULL];
>
How did you determine that was a valid key path to observe? (That is, that the property at the end of the key path - and all intermediate keys - supports KVO?)
In general you can't rely on any arbitrary property, especially of a user interface component like an NSWindow or NSView, supporting KVO.
Instead you should use the notifications the component makes available explicitly for notifying observers of interesting happenings.
-- Chris
_______________________________________________
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