我一直在閱讀不同來源的自動引用計數,但沒有找到任何明確我的理解的文章或文檔。我對ARC(自動引用計數)的理解是,它完全接管了開發人員對內存管理的控制,並將其分配給編譯器進行內存管理。自動引用計數混淆
我想對嗎?
那麼這是否意味着保留,發佈和autorelease不再是iOS 5 SDK?
例子:
可以說,我用它來作這樣的對象,
UIView *message = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, cell.frame.size.width, cell.frame.size.height)];
message.tag = 0;
[message addSubview:balloonView];
[message addSubview:label];
[cell.contentView addSubview:message];
[balloonView release];
[label release];
[message release];
會變成這個樣子IF ARC爲ON,
UIView *message = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, cell.frame.size.width, cell.frame.size.height)];
message.tag = 0;
[message addSubview:balloonView];
[message addSubview:label];
[cell.contentView addSubview:message];
任何輸入將有幫助謝謝
乾杯!