使用委託進行內存管理,我的理解是我不保留委託,如果視圖被卸載(通過viewDidUnload)並稍後重新創建(通過viewDidLoad),我有點不確定如何處理委託?與代表的內存管理?
@property(assign) SomeClass *someDelegate;
。
- (void)viewDidLoad {
[super viewDidLoad];
someDelegate = [[SomeClass alloc] init];
[someDelegate setDelegate:self];
}
-(void)viewDidUnload {
[super viewDidUnload];
[self setSomeDelegate:nil];
}
-(void)dealloc {
[super dealloc];
}
PS:我可能是在錯誤的軌道上,我只是試圖讓我的頭一輪這...
歡呼加里
編輯以反映代理更正/評論。 – fuzzygoat 2010-06-22 15:37:30