On 06/03/2008, at 10:10 AM, Jim Turner wrote:

Ok first, mmalc, thank you for taking the time to point out exactly
what I needed to see to understand where I was going wrong.  My
problem stemmed from the misguided idea that properties were required
for KVC/KVO.  Chris' comment about "using non-default names" makes
much more sense now.

Second, for my situation, I ended up with an interface that looks like this:

@property (getter=getValueForBindings, setter=setValueForBindings:,
assign, nonatomic) id value;

And an implementation:

-(void) setValueForBindings:(id)_value
{
        [self willChangeValueForKey:@"value"];
        {
                 BOOL didSetOK = [self setStringValue:(NSString *)_value];
              // Do something with didSetOK
        }
        [self didChangeValueForKey:@"value"];
}

-(id) getValueForBindings
{
        return( value );
}

Then binding my interface to the key 'valueForBindings'.  Not the
prettiest, but it's required for my situation.

Thanks again to everyone for all the help.

Why have you got calls to -willChangeValueForKey: and - didChangeValueForKey:? It should probably be done wherever value is changed, if it's not automatic. It's also not clear to me why you can't just name the methods setValue and value (and rename your other methods).

On a separate note, I would personally avoid using identifiers beginning with underscores. I'm pretty sure they are reserved but even if they're not, I would avoid it.

Kind regards,

Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to