当我创建要分配给属性的变量时,我可以执行以下操作(假设属性为@property (nonatomic,retain) UILabel *myLabel;):
UILabel *temp = [[UILabel alloc] init];
self.myLabel = temp;
[temp release];
在以下temp未使用的情况下会发生什么?
self.myLabel = [[UILabel alloc] init];
[myLabel release];
这是假设我会添加一个[myLabel release];由于dealloc属性。
这会是正确的内存管理吗?在第二个示例中,行myLabel后是否保留计数为 2 init?