开发者

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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜