Search code examples
iosuiviewautomatic-ref-countingdealloc

To nil out outlets in a custom UIView's dealloc under ARC?


Usually in a UIViewController subclass, I nil out all outlets in viewDidUnload. But in my custom UIView, should I nil out those outlets (defined in my custom UIView) in dealloc instead? Does ARC perform these actions automatically?


Solution

  • No, still do it in viewDidUnload to get them out of memory as fast as possible.

    ARC means you don't need to do it anywhere but it's still a bit more efficient if you do.

    Though you don't ever need to nil properties in deadlock when using arc in any of your classes.