Re: Odd binding issue
Re: Odd binding issue
- Subject: Re: Odd binding issue
- From: Allan Odgaard <email@hidden>
- Date: Fri, 12 Mar 2004 09:39:08 +0100
On 12. Mar 2004, at 9:23, Scott Anguish wrote:
[...] not the objects description. Here is what gets displayed:
<Item: 0x358970>. [...]
[...] a new implementation for description, which takes precedence
over the old one [...]
Well, yes, it's implemented using isa-swizzling, but I doubt very
much that is the issue here.
@interface foo : NSObject { }
@end
@implementation foo
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
NSLog(@"%@\n%@", keyPath, change);
}
@end
int main (int argc, char const* argv[])
{
[NSAutoreleasePool new];
NSObjectController* ctrl = [NSObjectController new];
[ctrl setContent:[NSDate date]];
NSLog(@"Description: %@", [ctrl
valueForKeyPath:@"selection.description"]);
NSObject* obj = [foo new];
[ctrl addObserver:obj forKeyPath:@"selection.description" options:0
context:NULL];
NSLog(@"Description: %@", [ctrl
valueForKeyPath:@"selection.description"]);
return 0;
}
Output is:
2004-03-12 09:35:12.444 a.out[5347] Description: 2004-03-12 09:35:12
+0100
2004-03-12 09:35:12.450 a.out[5347] Description: <NSCFDate: 0x506fd0>
I think it's likely something much simpler. Otherwise it's a bug, and
one I think I'd have seen before now.
Well, I have seen it before on a few occasions :)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.