NSCell + bindings
NSCell + bindings
- Subject: NSCell + bindings
- From: Byron Wright <email@hidden>
- Date: Tue, 26 Oct 2004 14:45:40 -0700
Hi,
I am having a problem understanding exactly what's going on with
NSCell. I created a custom NSCell which I want to diplay more than just
simple text or an image. I really need to get information from a custom
object so passing it a string or other intrinsic value just won't do. I
have a NSMatrix view that is bound to an NSArrayController that holds
some custom objects. The issue I am having is that my custom NSCell's
setObjectValue method is always getting called with the string
representation of the objects in the NSArrayController instead of the
object itself. What am I doing wrong?
Here is some an example :
/
/-----------------------------------------------------------------------
----------------------------------------------------------------
@interface CFCMyObject : NSObject
@end
/
/-----------------------------------------------------------------------
----------------------------------------------------------------
@implementation CFCObjectController // : NSArrayController
- (void) awakeFromNib
{
//gridView is an instance of CFCGridView : NSMatrix
[gridView bind: @"content" toObject: self
withKeyPath:@"arrangedObjects" options:nil];
}
@end
/
/-----------------------------------------------------------------------
----------------------------------------------------------------
@implementation CFCMyCell
- (void)setObjectValue:(id <NSCopying>) object
{
//i really want my CFCMyObject instances to be passed in here
NSLog(@"setObjectValue = %@",object);
[super setObjectValue:object];
if([object isKindOfClass : [NSString class]])
{
NSLog(@"what is the point of this method? passing a string as an id
seems useless");
}
}
@end
/
/-----------------------------------------------------------------------
----------------------------------------------------------------
Any help is much appreciated.
- Byron
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden