NSInteger 发布
DetailViewController.h
@interface DetailViewController : UIViewController {
NSInteger getInteger;
NSNumber *getNumber;
}
@property (nonatomic, retain) NSNumber *getNumber;
@property (nonatomic, retain) NSInteger getInteger => Doesn't work with warning.
我知道 NSNumber 能够释放。所以,我添加这样的代码:
DetailViewController.m
@synthesize getNumber;
...
...
- dealloc{
[getNumber release];
}
但是如何释放 NSInteger?不需要释放吗?我不知道这件事。
DetailViewController.h
@interface DetailViewController : UIViewController {
NSInteger getInteger;
NSNumber *getNumber;
}
@property (nonatomic, retain) NSNumber *getNumber;
@property (nonatomic, retain) NSInteger getInteger => Doesn't work with warning.
I know that NSNumber is able to release. So, I add code like this:
DetailViewController.m
@synthesize getNumber;
...
...
- dealloc{
[getNumber release];
}
But how to release NSInteger? Doesn't it require release? I don't know about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NSInteger
相当于int
(在 iPhone 上)。它不是 ObjC 对象。您不会也不能-retain
或-release
它们。NSInteger
is equivalent toint
(on iPhone). It is not an ObjC object. You won't and can't-retain
or-release
them.无分配 = 无解除分配。
NO ALLOC = NO DEALLOC.