It’s now more than 5 months that I’m in Objective-C, I’ve also got my first app published in the App Store, but I still have a doubt about a core functionality of the language.
When am I supposed to use self accessing iVars and when I’m not?
When releasing an outlet you write self.outlet = nil in viewDidUnload, instead in dealloc you write [outlet release]. Why?
When you write
self.outlet = nilthe method[self setOutlet:nil];is called. When you writeoutlet = nil;you access variableoutletdirectly.if you use
@synthesize outlet;then methodsetOutlet:is generated automatically and it releases object before assigning new one if you declared property as@property (retain) NSObject outlet;.