Declared Properties and assigning values with self
- by Shaun Budhram
I understand how declared properties work - I just need a clarification on when Objective C is using the accessor method vs. when it is not.
Say I have a property declared using retain:
@property (nonatomic, retain) NSDate *date;
... and later...
@synthesize date
If I say:
date = x
Is that calling the accessor method? Or is it just setting the variable?
self.date = x
This seems to call the accessor method (I think but I'm not sure, since it seems like the retain count is increasing).
Can anyone clarify this issue? I'm curious because i have some variables that seem to become invalid before I need them (and I have to specifically call retain), and I suspect this is why.