Re: Accessor method article preview
Re: Accessor method article preview
- Subject: Re: Accessor method article preview
- From: Marcel Weiher <email@hidden>
- Date: Thu, 27 Jun 2002 20:38:41 +0200
Good point. What I do in that case is split the thing up. One part is
the actual accessor (it just sets the instance variable), the other part
is the routine that does more work (and then isn't really just an
accessor, any more, IMHO).
So I\d have
idAccessor( image, _setImage )
-(void)setImage:(NSImage*)anImage
{
[self _setImage:anImage];
[scImageView setImage:anImage];
[self sizingOptionsDidChange];
}
But your solution looks good, too.
Regards,
Marcel
On Thursday, June 27, 2002, at 04:05 Uhr, Edwin Zacharias wrote:
It's definitely a good idea, but how often do you want an untyped
setter that just sets the ivar and does nothing else? Here's a setter
from my code:
- (void)setImage: (NSImage *)image
{
SCSETOBJECT( scImage, image );
[ scImageView setImage: image ];
[ self sizingOptionsDidChange ];
}
That's where my macro comes in handy. As far as I know there's no good
way to make it simpler.
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
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.