When I create a variable I want to assign to a property I can do the following (assuming the property is @property (nonatomic,retain) UILabel *myLabel;
):
UILabel *temp = [[UILabel alloc] init];
self.myLabel = temp;
[temp release];
What would happen in the following scenario where temp
is not used?
self.myLabel = [[UILabel alloc] init];
[myLabel release];
This is assuming I would add a [myLabel release];
in dealloc
due to the property.
Would this be proper memory management? In the second example does myLabel
have a retain count of 2 after the init
line?