Objective c 目标C:包含单个NSInteger的类是否需要释放?
我有一个包含单个NSInteger属性的类Objective c 目标C:包含单个NSInteger的类是否需要释放?,objective-c,memory,Objective C,Memory,我有一个包含单个NSInteger属性的类 @interface myTag @property (nonatomic) NSInteger tag; @property (nonatomic) NSInteger index; @end 我喜欢在代码中使用它 mytag = [[myTag alloc] init]; int num = (int)mytag.tag; [mytag release]; NSLog(@"num = %d",num); 我的问题是 在objc
@interface myTag
@property (nonatomic) NSInteger tag;
@property (nonatomic) NSInteger index;
@end
我喜欢在代码中使用它
mytag = [[myTag alloc] init];
int num = (int)mytag.tag;
[mytag release];
NSLog(@"num = %d",num);
我的问题是
给你一个小建议,在开始项目之前,请花些时间阅读objective C内存管理基础知识(我必须说,这并不容易)…苹果是一个很好的起点。。本教程提供了有关ARC的大量信息。@Aberrant不是该教程的副本。.OP询问是否需要释放包含NSInteger的类。.哦哦哦,等等,myTag是类,小写字母m让我困惑。好的,没有重复,删除注释。@lerosua还有时间,请务必阅读