This topic created in 4101 days ago, the information mentioned may be changed or developed.
各位都知道,设置了 xxx.delegate = self 后,需要在 dealloc 之类的地方 xxx.delegate = nil
那么,如果是在 IB 里设置了 tableview.delegate = file's owner
应该在哪里设置 .delegate = nil 呢?
还是不用设置?
8 replies • 2015-04-14 10:57:58 +08:00
 |
|
1
walkingway Mar 26, 2015
如果 tableview 只有 tableviewController 指向(strong)他,就不用,因为 tableviewController 销毁了,tableview 也跟着销毁了,当然 delegate 要设成 weak。
|
 |
|
3
huanglexus Mar 27, 2015 via iPhone 1
不用设置。。 代码写也不用写这多余的delegate=nil 因为这是weak指针。
|
 |
|
6
yetAnotherJoe Mar 27, 2015
You do not have to (indeed cannot) release instance variables, but you may need to invoke [self setDelegate:nil] on system classes and other code that isn’t compiled using ARC.
|
 |
|
7
kepenj Apr 1, 2015
保持良好习惯dealloc 里面制空。
|
 |
|
8
kobe1941 Apr 14, 2015
delegate一直用weak修饰,不用在dealloc里设置为nil,多此一举(ARC下)。
|