Re: Setter Getter on NSImageVIew / UIImageView?
Re: Setter Getter on NSImageVIew / UIImageView?
- Subject: Re: Setter Getter on NSImageVIew / UIImageView?
- From: Michael Ash <email@hidden>
- Date: Thu, 25 Jun 2009 00:56:49 -0400
On Tue, Jun 23, 2009 at 11:45 PM, Chunk 1978<email@hidden> wrote:
> i've seen code where this is written:
>
> -=-=-=-
> @property (nonatomic, retain) UIImageView *image;
> ...
> @synthisize image;
> ...
> [image release]; //in dealloc method
> -=-=-=-
>
> aren't setters/getters methods used only for objects that need to have
> their value changed? assuming the UIImageView in the above code
> always maintains the same image throughout the program, are setter and
> getters still required? perhaps the above code was written so the
> user could swap images within the same UIImageView, or animate the
> view? humm... would you even need to have setter and getters for
> animation?
The value does change. Your image variable starts out nil when the
object is constructed. A view will then be set later on as the GUI is
constructed, either in code or by loading a nib. That's already two
values, and that's enough to justify writing the proper code to handle
them. Further values are certainly possible but not necessary.
Mike
_______________________________________________
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