In objective-c I see a lot of sample code where the author assigns a local variable, assigns it to a property, then releases the local variable. Is there a practical reason for doing this? I've been just assigning directly to the property for the most part. Would that cause a memory leak in any way? I guess I'd like to know if there's any difference between this:
HomeScreenBtns *localHomeScreenBtns = [[HomeScreenBtns alloc] init];
self.homeScreenBtns = localHomeScreenBtns;
[localHomeScreenBtns release];
and this:
self.homeScreenBtns = [[HomeScreenBtns alloc] init];
Assuming that homeScreenBtns is a property like so:
@property (nonatomic, retain) HomeScreenBtns *homeScreenBtns;
I'm getting ready to submit my application to the app store so I'm in full optimize/QA mode.
See Question&Answers more detail:os