Retain and a "singleton" property at once?
I want to declare my property
as the following...
@property (non开发者_运维问答atomic, retain) NSString *phoneNumber;
But I also want to assign it an initial value during debugging such as (I don't want to input all the numbers manually)...
self.phoneNumber = @"123";
If I do as I have written, I must additionally somewhere retain this property
. Could someone please help me achieve this.
You should in dealloc
method release
all properties that has attribute retain
. You can do it by assigning
nil
value to your objects via self.
notation:
- (void)dealloc
{
self.phoneNumber = nil;
[super dealloc];
}
精彩评论