Re: BOOL madness
Re: BOOL madness
- Subject: Re: BOOL madness
- From: Jim Correia <email@hidden>
- Date: Tue, 11 Nov 2008 20:28:09 -0500
On Nov 11, 2008, at 8:08 PM, Andre Masse wrote:
I'm having trouble converting an object to a BOOL. In my window
controller, I'm observing the model keyPath isDirty which is a BOOL.
version 1
----------------
- (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
if(object == model) {
if([keyPath isEqualToString:@"isDirty"]) {
[self setDocumentEdited:[change
objectForKey:NSKeyValueChangeNewKey]];
}
}
}
I know this isn't the question you asked, nor the root of the problem
you are having, but by way of saving you future pain, that is not the
correct way to write an -
observeValueForKeyPath:ofObject:change:context: method.
Always use a unique context. Use the context to determine if the
message is for your (not object or keyPath comparisons.) Call super
for all contexts that you do not recognize as yours.
Additional details available in the list archives.
Jim
_______________________________________________
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
References: | |
| >BOOL madness (From: Andre Masse <email@hidden>) |