用来在dealloc的时候手动解除delegate关系。
比如开始的时候注册了notification等,那么是需要在dealloc中把这些notification移除掉。
dealloc会被调用(通常是以被编译器自动插入代码的方式),也可以实现(尤其是如果有某些非Cocoa对象资源需要管理的时候)。
ARC与非ARC的区别:
ARC中dealloc中不能调用[super dealloc]、[obj release]。会直接报错
用来在dealloc的时候手动解除delegate关系。
比如开始的时候注册了notification等,那么是需要在dealloc中把这些notification移除掉。
dealloc会被调用(通常是以被编译器自动插入代码的方式),也可以实现(尤其是如果有某些非Cocoa对象资源需要管理的时候)。
ARC与非ARC的区别:
ARC中dealloc中不能调用[super dealloc]、[obj release]。会直接报错