• 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: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
      • From: vade <email@hidden>
References: 
 >Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath (From: vade <email@hidden>)

  • Prev by Date: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
  • Next by Date: Re: nonatomic vs atomic assign/retain
  • Previous by thread: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
  • Next by thread: Re: Strange issue with NSPanel @"visible" keypath & observeValueForKeyPath
  • Index(es):
    • Date
    • Thread