保留和“单例”立即财产?
我想将我的 property
声明如下...
@property (nonatomic, retain) NSString *phoneNumber;
但我也想在调试期间为其分配一个初始值,例如(我不想手动输入所有数字)...
self.phoneNumber = @"123";
如果正如我所写的那样,我还必须在某个地方保留此属性。有人可以帮助我实现这一目标吗?
I want to declare my property
as the following...
@property (nonatomic, 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在
dealloc
方法中release
所有具有属性retain
的属性。您可以通过self.
表示法为对象分配nil
值来完成此操作:You should in
dealloc
methodrelease
all properties that has attributeretain
. You can do it byassigning
nil
value to your objects viaself.
notation: