When do you have to use @property and @synthesize in the iPhone SDK? -
You have to use when @property
and @synthesize
IPhone SDK? And why use @property
and @ synthesis
? I was studying the property, but I can not find the right idea.
@property: This is used when you use it:
/ P>
You can actually create useful generating codes such as nonatomic, atmoic, without writing any line of code. You have gotter and setter methods too To use it, you have 2 other ways: @ synthesize or @dynamic: @ synthesize, the compiler will automatically generate recipients and setter for you, @dynamic: you have to manually would write.
@Property is really good for memory management, for example: Maintaining
How can you maintain without a property?
if (_variable! = Object) {[_variable release]; _variable = zero; _variable = [object maintenance]; }
How can you use it with a @ property?
self.variable = object;
When you are calling up the line, you actually call the Setter [Auto SetValue: Object] and then the Generator Setter will do your job
Comments
Post a Comment