Re: Correct way to overide synthesized setter?
Re: Correct way to overide synthesized setter?
- Subject: Re: Correct way to overide synthesized setter?
- From: Jens Alfke <email@hidden>
- Date: Sun, 28 Feb 2010 09:26:26 -0800
On Feb 28, 2010, at 8:23 AM, Chris Tracewell wrote:
> I have two synthesized properties - A and B. Whenever A changes I need B to be updated to A.keypath.
If B's value is entirely dependent upon A, you don't even need to synthesize it — you can just implement B's getter to return A.keypath, and declare B as dependent on A:
- (NSString*) b {return A.keypath; }
+ (NSArray*) keyPathsForValuesAffectingB { return [NSArray arrayWithObject: @"a"]; }
—Jens_______________________________________________
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