On 12/18/09 12:13 PM, Quincey Morris said:
>Some people use globally unique strings for the context. I tend to use
>the class:
>
> [addObserver: ... forKeyPath: ... options: ... context: [MyClass
> class]];
I suppose that usage is safe, but in general it's dangerous to use an
Obj-C object
On Dec 18, 2009, at 2:56 PM, Kyle Sluder wrote:
On Fri, Dec 18, 2009 at 11:48 AM, Paul Bruneau
wrote:
Ugh, so I guess you are saying that derived properties are not
trustworthy
in this usage?
No, just that if you don't actually change the value, KVO might not
bother notifying listeners. T
On Dec 18, 2009, at 11:18, Paul Bruneau wrote:
>> 2. Your observer method is stripped down, right? You are really using a
>> unique value for the context parameter, right? It's not really safe to just
>> not care.
>
> No, I'm not using context. My feeling was that since I am checking for the
>
On Dec 18, 2009, at 11:28, Kyle Sluder wrote:
> Please note that it is not correct to call -will/didChangeValueForKey:
> without actually changing the value. The KVO mechanism might just
> simply not send a notification at all. (Well, I guess it's valid, but
> you might see fewer observation notif
On Fri, Dec 18, 2009 at 11:48 AM, Paul Bruneau
wrote:
> Ugh, so I guess you are saying that derived properties are not trustworthy
> in this usage?
No, just that if you don't actually change the value, KVO might not
bother notifying listeners. The actual values are fine, just wanted to
address th
On Dec 18, 2009, at 2:28 PM, Kyle Sluder wrote:
On Fri, Dec 18, 2009 at 11:18 AM, Paul Bruneau
wrote:
if ([keyPath isEqualToString:kOverallWidth]) {
[self willChangeValueForKey:@"overallWidth"];
NSLog(@"got notification that overallwidth
On Fri, Dec 18, 2009 at 11:18 AM, Paul Bruneau
wrote:
>> if ([keyPath isEqualToString:kOverallWidth]) {
>> [self willChangeValueForKey:@"overallWidth"];
>> NSLog(@"got notification that overallwidth changed:
>> %@", object);
>>
On Dec 18, 2009, at 2:08 PM, Quincey Morris wrote:
This is a situation where you use willChangeValueForKey:/
didChangeValueForKey:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:
(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath
On Dec 18, 2009, at 10:20, Paul Bruneau wrote:
> I am setting up the object that holds the dependent value as an observer of
> the individual members of the collection like this:
>
> [theFrameModule addObserver:self forKeyPath:kOverallWidth
> options:NSKeyValueObservingOptionNew context:NULL];